Skip to content

Commit

Permalink
patch: fix rehype-katex to accept undefined as top parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
LumaKernel committed Feb 4, 2024
1 parent a3e0725 commit 4cd2365
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/rehype-katex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,16 @@ const expressionOfMdxJsxExpressionAttribute = (

export type RehypeKatexPlugin = import("unified").Plugin<
[
Readonly<{
dynamicSuffix?: () => string;
}>,
| Readonly<{
dynamicSuffix?: () => string;
}>
| undefined,
],
Root
>;
const rehypeKatex: RehypeKatexPlugin = ({
dynamicSuffix = () => Math.random().toString(36).slice(2),
}) => {
} = {}) => {
return async (tree, file) => {
const dynamicKeyName = `_rehypeKatexContext${dynamicSuffix()}`;
tree.children.unshift({
Expand Down

0 comments on commit 4cd2365

Please sign in to comment.