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

Rust support for triple slash comments #8

Closed ciresnave closed 9 months ago

ciresnave commented 9 months ago

Good morning!

Rust uses a triple slash at the beginning of doc comments. Doc comments are interpreted as Markdown when the Rust code is sent to crates.io. I'm trying to figure out how best to add a rule for triple slashes but so far my attempts to modify the double slash rule from vscode-markdown-everywhere's docs have failed. I would assume adding triple slash support would be simple. Can anyone suggest how to achieve it?

Thanks!

zhaouv commented 9 months ago

I have not tested, this should work

"markdown-everywhere.customized-rules": [
    "defaultRules",
    {
        "name": "triple-slash",
        "whileRegExp": "///",
        "example": "/// # title<br>/// content<br>",
        "languages": [
            { "name": "rust", "source": "source.rust" }
        ]
    }
]

or { "name": "Rust", "source": "source.Rust" }

ciresnave commented 9 months ago

Initially, this didn't work. Restarting VSCode didn't help. Rebooting the whole PC made it work flawlessly. Thank you!