You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Lua parser requires either LuaTeX or shell access, which creates a vulnerability. Futhermore, the Lua parser receives entire markdown documents and any error in processing a document can not easily be debugged from TeX. What is more: adding syntax extensions of Markdown requires extensive knowledge of Lua and LPEG.
A rewrite of the Lua parser into TeX using the l3regex library of expl3 would make it possible to parse Markdown document in TeX without shell access. Any error in parsing could be debugged directly from TeX and new syntax extensions of Markdown could be added by TeX packages using macro programming.
There are several concerns:
Rewriting the Lua parser into expl3 is no small effort, which would require a dedicated programmer. The expl3 parser and the Lua parser would also have to live side-by-side for some period of time as two alternative parsers to be used by the higher layers of the Markdown package.
Whereas the Lua parser uses the speedy C library of LPEG, l3regex uses slow dynamic programming with TeX macros. A small subset of the markdown language should be implemented in expl3 and benchmarked against the Lua parser to see if the speed of the expl3 parser would be acceptable.
Line breaks in Markdown are typed as trailing spaces at the end of a line. The input processor of TeX strips these before we can do anything (see also Preserve trailing spaces in ConTeXt MkIV #101). There may be other elements of markdown that cannot be parsed in TeX.
This discussion was converted from issue #133 on June 11, 2022 10:27.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
The Lua parser requires either LuaTeX or shell access, which creates a vulnerability. Futhermore, the Lua parser receives entire markdown documents and any error in processing a document can not easily be debugged from TeX. What is more: adding syntax extensions of Markdown requires extensive knowledge of Lua and LPEG.
A rewrite of the Lua parser into TeX using the l3regex library of expl3 would make it possible to parse Markdown document in TeX without shell access. Any error in parsing could be debugged directly from TeX and new syntax extensions of Markdown could be added by TeX packages using macro programming.
There are several concerns:
Beta Was this translation helpful? Give feedback.
All reactions