-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0a69521
commit 587dda4
Showing
5 changed files
with
140 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// import { Literal } from 'hast'; | ||
// import { Parent, Root } from 'mdast'; | ||
// import { visit } from 'unist-util-visit'; | ||
|
||
// import { Context } from '../context'; | ||
|
||
// export function aliasDirectiveToTex(ctx: Context) { | ||
// return (tree: Root) => { | ||
// visit(tree, 'textDirective', (node) => { | ||
// switch (node.name) { | ||
// case 'inlineMath': { | ||
// const tex = getStoredTex(node, ctx); | ||
// node.data = getTexSpan(tex, 'inline'); | ||
// break; | ||
// } | ||
// case 'blockMath': { | ||
// const tex = getStoredTex(node, ctx); | ||
// node.data = getTexSpan(tex, 'block'); | ||
// break; | ||
// } | ||
// } | ||
// }); | ||
// }; | ||
// } | ||
|
||
// function getStoredTex(node: Parent, ctx: Context) { | ||
// if (!ctx.mmlStore) { | ||
// throw new Error(`[tex-directive-to-text]: no ctx.mmlStore`); | ||
// } | ||
// const idx = getTexIdx(node); | ||
// return ctx.mmlStore[idx]; | ||
// } | ||
|
||
// function getTexIdx(node: Parent) { | ||
// const firstChild = node.children[0] as Literal; | ||
// return Number(firstChild.value || 0); | ||
// } | ||
|
||
// function getTexSpan(tex: string, display: 'inline' | 'block') { | ||
// return { | ||
// hName: 'span', | ||
// hProperties: { className: ['tex'] }, | ||
// hChildren: [ | ||
// { | ||
// type: 'text', | ||
// value: display === 'inline' ? `$${tex}$` : `$$\n${tex}\n$$`, | ||
// }, | ||
// ], | ||
// }; | ||
// } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters