zhaouv / vscode-markdown-everywhere

Embed and highlight and preview markdown in any language which support line-comment or block-comment for vscode.
https://marketplace.visualstudio.com/items?itemName=zhaouv.vscode-markdown-everywhere
Apache License 2.0
9 stars 3 forks source link

Support Documenter.jl style LaTeX-math-fencing #9

Closed frankier closed 7 months ago

frankier commented 7 months ago

Thanks for your work on this extension. It's really nice seeing this inline in vscode.

Documenter.jl encourages LaTeX-math to be fenced with double backticks `` or else as ```math. This seems to currently be unsupported. See https://documenter.juliadocs.org/stable/man/latex/

zhaouv commented 7 months ago

This is unrelated content to the extension. This can be easily achieved by mimicking vscode-python-highlight-cell-splitter and this extension. It will likely be less than 40 lines in the end, constituting a standalone new extension. I am not interested in it.

frankier commented 7 months ago

Okay! Very understandable. Thanks for explaining.

zhaouv commented 7 months ago

if you want to highlight them as a raw string. you could make a new extrension and match them and mark them as raw string by syntaxes json.
if you want to highlight them as a latex statement. you could make a new extension and match them and reinject latex grammer, only one additional line changed like "include": "text.html.markdown".
if you want to display them in preview mode, it is related. you could fork this extension, and change preview part js code. match and replace "``" to "$" and "```math" to "$$" before source code sent to vsc markdown parser, then MarkdownIt will show them as equ, it is not a widely used rule so i won't do it in this extension.

zhaouv commented 1 month ago

have added a feature preview-inject for previewing latex. also done this

settings.json

    "markdown-everywhere.preview-mode-inject": [
        {"language":"julia","path":".*","beforeSource":" return args.src.replace(/```math/g,'$$$$\\n').replace(/```/g,'\\n$$$$').replace(/``/g,'$').replace(/\\\\\\\\/g,'\\\\') "}
    ],

image