Skip to content

Commit

Permalink
Resolve #122 supporting Markdown Fenced Code Block
Browse files Browse the repository at this point in the history
Syntax highlighting inside markdown code blocks:

```elixir
Graph.match(
  from person in "Person",
    where: person.age < 32 and person.title == "Developer",
    join: friend in "Person", on: "FRIEND",
    join: fof, on: "FRIEND",
    join: work, on: "WORKED_WITH",
    select: {person.name, friend.name, fof.name, work.name}
)
```

Inspired by https://github.com/mjbvz/vscode-fenced-code-block-grammar-injection-example
  • Loading branch information
Son Tran-Nguyen authored and sntran committed Feb 26, 2018
1 parent bd64849 commit 88510bb
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
8 changes: 8 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,14 @@
"language": "HTML (Eex)",
"scopeName": "text.html.elixir",
"path": "./syntaxes/html (eex).json"
},
{
"scopeName": "markdown.elixir.codeblock",
"path": "./syntaxes/codeblock.json",
"injectTo": ["text.html.markdown"],
"embeddedLanguages": {
"meta.embedded.block.elixir": "elixir"
}
}
],
"snippets": [
Expand Down
28 changes: 28 additions & 0 deletions syntaxes/codeblock.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"fileTypes": [],
"injectionSelector": "L:markup.fenced_code.block.markdown",
"patterns": [
{
"include": "#plantuml-code-block"
}
],
"repository": {
"plantuml-code-block": {
"begin": "elixir(\\s+[^`~]*)?$",
"end": "(^|\\G)(?=\\s*[`~]{3,}\\s*$)",
"patterns": [
{
"begin": "(^|\\G)(\\s*)(.*)",
"while": "(^|\\G)(?!\\s*([`~]{3,})\\s*$)",
"contentName": "meta.embedded.block.elixir",
"patterns": [
{
"include": "source.elixir"
}
]
}
]
}
},
"scopeName": "markdown.elixir.codeblock"
}

0 comments on commit 88510bb

Please sign in to comment.