Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use KaTeX AST instead of reparsing the whole tree #16

Closed
sandhose opened this issue Jan 28, 2018 · 4 comments
Closed

Use KaTeX AST instead of reparsing the whole tree #16

sandhose opened this issue Jan 28, 2018 · 4 comments
Assignees
Labels
👀 no/external This makes more sense somewhere else

Comments

@sandhose
Copy link

Right now remark-math uses KaTeX's renderToString method to generate HTML, then reparses it directly afterwards using rehype-parse.

This is expensive, but was necessary because KaTeX used to not expose their internal AST.

I opened a while ago an issue on their side to expose this AST in order to have better renderers. It seems like now they do. KaTeX/KaTeX#800 (comment)

It would be great if remark-math did the conversion from KaTeX's AST to HAST nodes directly, instead of parsing the stringified DOM tree

@Rokt33r Rokt33r self-assigned this Jan 29, 2018
@Rokt33r
Copy link
Member

Rokt33r commented Jan 29, 2018

Sounds reasonable!

@ibrahima
Copy link

Just to be clear, this is only applicable to remark-html-katex, right? remark-html itself has nothing to do with KaTeX, it's just parsing out LaTeX nodes for remark?

@wooorm
Copy link
Member

wooorm commented Aug 8, 2019

@ibrahima This relates to rehype-katex and remark-html-katex. They both include an HTML parser because KaTeX spits out an HTML string that needs to be transformed into our AST.

I’ve reached out to KaTeX people again and may be able to work on using hast in KaTeX.

@wooorm
Copy link
Member

wooorm commented Aug 12, 2019

I don’t think it’s useful to track this there as it’s tracked upstream. Closing.

@wooorm wooorm closed this as completed Aug 12, 2019
@wooorm wooorm added the 👀 no/external This makes more sense somewhere else label Aug 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
👀 no/external This makes more sense somewhere else
Development

No branches or pull requests

4 participants