Using MDAST to do "smart" Markdown formatting #85
Replies: 1 comment 2 replies
-
@wooorm related to this use case, I'm hitting a performance wall with On a few paragraphs of plain (no Markdown formatting) text, the Javascript takes ~0.5s to parse. My approach is to reconstruct the MDAST often (max every 0.5s) when the user is editing the text; clearly this is wasteful because we discard and reconstruct the whole AST needlessly. Is there a library extension / method you'd suggest for adjusting the MDAST given knowledge of a similar AST based on similar input text? |
Beta Was this translation helpful? Give feedback.
-
Hi All!
I'm working on an iPad app that heavily relies on MDAST.
The user can use a stylus to draw a line through some text, causing a
strikethroughformat. To be a bit more clever, I try to reason about the formatting that's already applied.**~~test~~ post**
should result in~~**test post**~~
instead of~~**~~test~~ post**~~
.MDAST has been absolutely indispensable for this! It's also the only library I found with "source position" support that actually works (cmark tries to provide it but it's horrifically buggy and inaccurate).
Thanks for the great library! If you'd like to try out the app, there's a Testflight here.
Beta Was this translation helpful? Give feedback.
All reactions