vscode-markdown
vscode-markdown copied to clipboard
Liquid tags within Markdown sections are not always handled correctly
What's the problem
The Markdown plugin's syntax highlighter doesn't properly handle Liquid tags embedded within Markdown.
We author documentation using Jekyll, which uses Liquid tags within the Markdown.
Liquid tags typically are wrapped with {% foo %}
or {{ bar }}
symbols.
To comment out sections in Jekyll, you're supposed to use the Liquid {% comment %}
and {% endcomment %}
tags because it strips out the commented sections before it gets processed by the parser.
If you try to use these tags in VS Code, you get strange behavior.
It's not clear what triggers the end of the comment, as sometimes it continues into the next section.
What's the expected result
The Markdown plugin should handle Liquid tags within Markdown, particularly Liquid/Jekyll style comment tags.
How to reproduce
- Wrap part of a Markdown file with
{% comment %}
and{% endcomment %}
tags.
# A Heading
This is an intro sentence.
{% comment %}
This paragraph should be commented out.
{% endcomment %}
This paragraph should not be commented out.
{% comment %}Another commented out sentence.{% endcomment %} But this sentence should show up.
Current output:
Other information
I've installed the VS Code Liquid plugin but when you override the syntax highlighter to use it instead, it doesn't render the Markdown well, and has its own syntax problems with different symbols.
Thanks for the feedback.
There seem to be two things: { syntax highlight, rendering } of Liquid tags. The syntax highlight could be done by writing some tmLanguage rules (as how it is done for the Math syntax) and the latter requires a markdown-it
plugin which changes how Markdown is converted to HTML.
They are not easy. Given the popularity of Jekyll, there may be someone willing to help.