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

feat: added fenced code support for markdown files #1485

Merged
merged 4 commits into from
Dec 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- Upgrade to TypeScript 3.7 with Optional Chaining and Nullish Coalescing. #1510.
- 🙌 Fix syntax highlighting for interpolation in attributes with numbers (such as `x1`). Thanks to contribution from [Niklas Higi](https://github.com/shroudedcode). #1465.
- 🙌 Fix syntax highlighting for backticked vue code block in Markdown file. Thanks to contribution from [Abdelrahman Awad](https://github.com/logaretm). #1024 and #1485.

### 0.22.6 | 2019-10-23 | [VSIX](https://marketplace.visualstudio.com/_apis/public/gallery/publishers/octref/vsextensions/vetur/0.22.6/vspackage)

Expand Down
10 changes: 10 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,16 @@
"injectTo": [
"source.vue"
]
},
{
"scopeName": "markdown.vue.codeblock",
"path": "./syntaxes/markdown-vue.json",
"injectTo": [
"text.html.markdown"
],
"embeddedLanguages": {
"meta.embedded.block.vue": "vue"
}
}
],
"configuration": {
Expand Down
45 changes: 45 additions & 0 deletions syntaxes/markdown-vue.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"scopeName": "markdown.vue.codeblock",
"fileTypes": [],
"injectionSelector": "L:text.html.markdown",
"patterns": [
{
"include": "#vue-code-block"
}
],
"repository": {
"vue-code-block": {
"begin": "(^|\\G)(\\s*)(\\`{3,}|~{3,})\\s*(?i:(vue)(\\s+[^`~]*)?$)",
"name": "markup.fenced_code.block.markdown",
"end": "(^|\\G)(\\2|\\s{0,3})(\\3)\\s*$",
"beginCaptures": {
"3": {
"name": "punctuation.definition.markdown"
},
"5": {
"name": "fenced_code.block.language"
},
"6": {
"name": "fenced_code.block.language.attributes"
}
},
"endCaptures": {
"3": {
"name": "punctuation.definition.markdown"
}
},
"patterns": [
{
"begin": "(^|\\G)(\\s*)(.*)",
"while": "(^|\\G)(?!\\s*([`~]{3,})\\s*$)",
"contentName": "meta.embedded.block.vue",
"patterns": [
{
"include": "source.vue"
}
]
}
]
}
}
}
10 changes: 10 additions & 0 deletions test/grammar/fixture/embedded.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
```vue
<template>
<div></div>
</template>
<style>
.foo {
color: blue;
}
</style>
```
Loading