Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix markdown issues #208

Merged
merged 25 commits into from
May 17, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: add Markdown syntax highlighting
  • Loading branch information
Nate Moore committed May 17, 2021
commit fd7f84bb2348741dee032c4726ac463e670b1135
61 changes: 29 additions & 32 deletions tools/astro-vscode/syntaxes/astro-markdown.tmLanguage.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
{
"information_for_contributors": [
"This file has been converted from https://github.com/microsoft/vscode-markdown-tm-grammar/blob/master/syntaxes/markdown.tmLanguage",
"If you want to provide a fix or improvement, please create a pull request against the original repository.",
"Once accepted there, we are happy to receive an update request."
"This file has been modified from https://github.com/microsoft/vscode-markdown-tm-grammar/commit/399ff6f608a7bef3f68713be23cdcb4c6d475804"
],
"version": "https://github.com/microsoft/vscode-markdown-tm-grammar/commit/399ff6f608a7bef3f68713be23cdcb4c6d475804",
"name": "Astro Markdown",
"scopeName": "text.html.markdown.astro",
"patterns": [
Expand Down Expand Up @@ -75,7 +72,7 @@
]
},
"blockquote": {
"begin": "(^|\\G)[ ]{0,}(>) ?",
"begin": "(^|\\G)\\s*(>) ?",
"captures": {
"2": {
"name": "punctuation.definition.quote.begin.markdown"
Expand Down Expand Up @@ -1990,7 +1987,7 @@
"name": "markup.fenced_code.block.markdown"
},
"heading": {
"match": "(?:^|\\G)[ ]{0,}(#{1,6}\\s+(.*?)(\\s+#{1,6})?\\s*)$",
"match": "(?:^|\\G)\\s*(#{1,6}\\s+(.*?)(\\s+#{1,6})?\\s*)$",
"captures": {
"1": {
"patterns": [
Expand All @@ -2008,7 +2005,7 @@
"include": "#inline"
},
{
"include": "text.html.derivative"
"include": "text.html.astro"
}
]
},
Expand All @@ -2031,7 +2028,7 @@
"include": "#inline"
},
{
"include": "text.html.derivative"
"include": "text.html.astro"
}
]
},
Expand All @@ -2054,7 +2051,7 @@
"include": "#inline"
},
{
"include": "text.html.derivative"
"include": "text.html.astro"
}
]
},
Expand All @@ -2077,7 +2074,7 @@
"include": "#inline"
},
{
"include": "text.html.derivative"
"include": "text.html.astro"
}
]
},
Expand All @@ -2100,7 +2097,7 @@
"include": "#inline"
},
{
"include": "text.html.derivative"
"include": "text.html.astro"
}
]
},
Expand All @@ -2123,7 +2120,7 @@
"include": "#inline"
},
{
"include": "text.html.derivative"
"include": "text.html.astro"
}
]
},
Expand Down Expand Up @@ -2176,7 +2173,7 @@
"1": {
"patterns": [
{
"include": "text.html.derivative"
"include": "text.html.markdown.astro"
}
]
},
Expand All @@ -2198,30 +2195,30 @@
"begin": "(\\s*|$)",
"patterns": [
{
"include": "text.html.derivative"
"include": "text.html.markdown.astro"
}
],
"while": "(?i)^(?!.*</(script|style|pre)>)"
"while": "(?i)^(?!.*</(script|style|pre|Markdown)>)"
}
]
},
{
"begin": "(?i)(^|\\G)\\s*(?=</?[a-zA-Z]+[^\\s/&gt;]*(\\s|$|/?>))",
"begin": "(?i)(?=</?[a-zA-Z]+[^\\s/&gt;]*(\\s|$|/?>))",
"while": "(?i)^(?!.*</(\\1||\\2)>)",
"patterns": [
{
"include": "text.html.derivative"
"include": "text.html.astro"
}
],
"while": "^(?!\\s*$)"
]
},
{
"begin": "(^|\\G)\\s*(?=(<[a-zA-Z0-9\\-](/?>|\\s.*?>)|</[a-zA-Z0-9\\-]>)\\s*$)",
"begin": "(?=(<[a-zA-Z0-9\\-](/?>|\\s.*?>)|</[a-zA-Z0-9\\-]>)\\s*$)",
"patterns": [
{
"include": "text.html.derivative"
"include": "text.html.astro"
}
],
"while": "^(?!\\s*$)"
"while": "(?i)^(?!.*</(\\1||\\2)>)"
}
]
},
Expand Down Expand Up @@ -2287,18 +2284,18 @@
"include": "#inline"
},
{
"include": "text.html.derivative"
"include": "text.html.astro"
},
{
"include": "#heading-setext"
}
],
"while": "(^|\\G)(?!\\s*$|#|[ ]{0,}([-*_>][ ]{2,}){3,}[ \\t]*$\\n?|[ ]{0,}[*+->]|[ ]{0,}[0-9]+\\.)"
"while": "(^|\\G)(?!\\s*$|#|\\s*([-*_>][ ]{2,}){3,}[ \\t]*$\\n?|\\s*[*+->]|\\s*[0-9]+\\.)"
},
"lists": {
"patterns": [
{
"begin": "(^|\\G)([ ]{0,})([*+-])([ \\t])",
"begin": "(^|\\G)(\\s*)([*+-])([ \\t])",
"beginCaptures": {
"3": {
"name": "punctuation.definition.list.begin.markdown"
Expand All @@ -2317,7 +2314,7 @@
"while": "((^|\\G)([ ]{2,4}|\\t))|(^[ \\t]*$)"
},
{
"begin": "(^|\\G)([ ]{0,})([0-9]+\\.)([ \\t])",
"begin": "(^|\\G)(\\s*)([0-9]+\\.)([ \\t])",
"beginCaptures": {
"3": {
"name": "punctuation.definition.list.begin.markdown"
Expand All @@ -2337,23 +2334,23 @@
]
},
"paragraph": {
"begin": "(^|\\G)[ ]{0,}(?=\\S)",
"begin": "(^|\\G)\\s*(?=\\S)",
"name": "meta.paragraph.markdown",
"patterns": [
{
"include": "#inline"
},
{
"include": "text.html.derivative"
"include": "text.html.astro"
},
{
"include": "#heading-setext"
}
],
"while": "(^|\\G)((?=\\s*[-=]{3,}\\s*$)|[ ]{4,}(?=\\S))"
"while": "(^|\\G)(?=\\s*[-=]{3,}\\s*$)"
},
"separator": {
"match": "(^|\\G)[ ]{0,}([\\*\\-\\_])([ ]{0,2}\\2){2,}[ \\t]*$\\n?",
"match": "(^|\\G)\\s*([\\*\\-\\_])([ ]{0,2}\\2){2,}[ \\t]*$\\n?",
"name": "meta.separator.markdown"
},
"frontMatter": {
Expand Down Expand Up @@ -2436,7 +2433,7 @@
"end": "(?<=>)",
"patterns": [
{
"include": "text.html.derivative"
"include": "text.html.astro"
}
]
},
Expand Down Expand Up @@ -2590,7 +2587,7 @@
"end": "(?<=>)",
"patterns": [
{
"include": "text.html.derivative"
"include": "text.html.astro"
}
]
},
Expand Down
70 changes: 66 additions & 4 deletions tools/astro-vscode/syntaxes/astro.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
"keyEquivalent": "^~H",
"name": "Astro",
"patterns": [
{
"include": "#astro-markdown"
},
{
"include": "#astro-expressions"
},
Expand Down Expand Up @@ -472,6 +475,32 @@
}
]
},
{
"begin": "(</?)([A-Z][a-zA-Z0-9-]*)(\\:(load|idle|visible))?",
"beginCaptures": {
"1": {
"name": "punctuation.definition.tag.begin.html"
},
"2": {
"name": "entity.name.tag.component.astro"
},
"3": {
"name": "keyword.control.loading.astro"
}
},
"end": "(/?>)",
"endCaptures": {
"1": {
"name": "punctuation.definition.tag.end.html"
}
},
"name": "meta.tag.component.astro",
"patterns": [
{
"include": "#tag-stuff"
}
]
},
{
"begin": "(</?)([a-zA-Z0-9:-]+)",
"beginCaptures": {
Expand Down Expand Up @@ -672,18 +701,51 @@
{
"include": "#string-single-quoted"
},
{
"include": "#astro-load-directive"
},
{
"include": "#astro-expressions"
},
{
"include": "#astro-markdown"
}
]
},
"astro-markdown": {
"begin": "(?<!</(?:Markdown))(>)",
"end": "(?<=</(Markdown))(>)(?:\\s*\\n)?",
"contentName": "text.html.markdown.astro",
"begin": "(?:^\\s+)?(<)(Markdown)\\b(?=[^>]*)",
"beginCaptures": {
"1": {
"name": "punctuation.definition.tag.begin.html"
},
"2": {
"name": "entity.name.tag.markdown.astro"
}
},
"end": "(</)(Markdown)(>)",
"endCaptures": {
"2": {
"name": "punctuation.definition.tag.html"
}
},
"name": "text.html.markdown.astro",
"patterns": [
{
"include": "text.html.markdown.astro"
"include": "#tag-stuff"
},
{
"begin": "(>)",
"beginCaptures": {
"1": {
"name": "punctuation.definition.tag.end.html"
}
},
"end": "(?=</Markdown)",
"patterns": [
{
"include": "text.html.markdown.astro"
}
]
}
]
},
Expand Down