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

Highlighting quotes, strikethrough, and math formulas #6

Open MatrixRanger98 opened 3 years ago

MatrixRanger98 commented 3 years ago

Quotes, strikethrough, and math formulas (inline or standalone) are also quite common when we write markdown in additional to bold, italic, and headers. Would you like to add their syntax highlighting as well in the source code? Really appreciate it!

zhaouv commented 3 years ago

they are not hightlighted in a default vscode ide without user installed extensions. and it seems that the injection of one extension can not see other extension's injection. It may be that vscode wants to avoid some kind of loop. for example, python fenced code in a.md and using markdown down rule # MD xxx is not markdown, which works in normal python files

md

py

so for inline math, I use an extension markdown+math to highlight content in dollars, but when it is in mardown which is in python, it not works just like the previous case

md md

in this extension, I just include the the scope text.html.markdown. so it could only highlighting the things which is highlighted in default vscode. if you want get more things highlighted. you need it a more complex realization.

(my realization is just something like this)

{
    "injectionSelector": "L:source.coffee -string -comment -meta.embedded.block.everywhere.md, L:source.dockerfile -string -comment -meta.embedded.block.everywhere.md, L:text.git-commit -string -comment -meta.embedded.block.everywhere.md, L:text.git-rebase -string -comment -meta.embedded.block.everywhere.md, L:source.diff -string -comment -meta.embedded.block.everywhere.md, L:source.ignore -string -comment -meta.embedded.block.everywhere.md, L:source.ini -string -comment -meta.embedded.block.everywhere.md, L:source.makefile -string -comment -meta.embedded.block.everywhere.md, L:source.perl -string -comment -meta.embedded.block.everywhere.md, L:source.perl.6 -string -comment -meta.embedded.block.everywhere.md, L:source.powershell -string -comment -meta.embedded.block.everywhere.md, L:source.python -string -comment -meta.embedded.block.everywhere.md, L:source.r -string -comment -meta.embedded.block.everywhere.md, L:source.ruby -string -comment -meta.embedded.block.everywhere.md, L:source.shell -string -comment -meta.embedded.block.everywhere.md, L:source.yaml -string -comment -meta.embedded.block.everywhere.md, L:source.cython -string -comment -meta.embedded.block.everywhere.md, L:source.julia -string -comment -meta.embedded.block.everywhere.md, L:source.cmake -string -comment -meta.embedded.block.everywhere.md",
    "patterns": [
        {
            "include": "#comment-markdown-cell-inject-number-sign-MD-LRSW"
        }
    ],
    "repository": {
        "comment-markdown-cell-inject-number-sign-MD-LRSW": {
            "begin": "(^|\\G)\\s*(# MD) ?",
            "captures": {
                "2": {
                    "name": "comment.punctuation.definition.quote_code.number-sign-MD.LRSW"
                }
            },
            "name": "comment.quote_code.number-sign-MD.LRSW",
            "contentName": "meta.embedded.block.everywhere.md",
            "patterns": [
                {
                    "include": "text.html.markdown"
                }
            ],
            "while": "(^|\\G)\\s*(# MD) ?"
        }
    },
    "scopeName": "comment.markdown-cell-inject.number-sign-MD.LRSW"
}