Skip to content

Commit

Permalink
Merge pull request juanfranblanco#416 from tonisives/inject-markdown
Browse files Browse the repository at this point in the history
add highlight in markdown
  • Loading branch information
juanfranblanco authored Feb 7, 2024
2 parents b3e03de + a941d99 commit 46baf6c
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 2 deletions.
19 changes: 17 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"files": [
"/dist/cli"
],
"activationEvents": [],
"contributors": [
"Juan Blanco"
],
Expand Down Expand Up @@ -249,6 +250,9 @@
".sol"
],
"configuration": "./solidity.configuration.json"
},
{
"id": "solidity-markdown-injection"
}
],
"commands": [
Expand Down Expand Up @@ -593,7 +597,18 @@
"unbalancedBracketScopes": [
"meta.scope.case-pattern.solidity"
]
}
},
{
"language": "solidity-markdown-injection",
"scopeName": "markdown.solidity.codeblock",
"path": "./syntaxes/solidity-markdown-injection.json",
"injectTo": [
"text.html.markdown"
],
"embeddedLanguages": {
"meta.embedded.block.solidity": "solidity"
}
}
]
}
}
}
45 changes: 45 additions & 0 deletions syntaxes/solidity-markdown-injection.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"fileTypes": [],
"injectionSelector": "L:text.html.markdown",
"patterns": [
{
"include": "#solidity-code-block"
}
],
"repository": {
"solidity-code-block": {
"begin": "(^|\\G)(\\s*)(\\`{3,}|~{3,})\\s*(?i:(solidity)(\\s+[^`~]*)?$)",
"name": "markup.fenced_code.block.markdown",
"end": "(^|\\G)(\\2|\\s{0,3})(\\3)\\s*$",
"beginCaptures": {
"3": {
"name": "punctuation.definition.markdown"
},
"4": {
"name": "fenced_code.block.language.markdown"
},
"5": {
"name": "fenced_code.block.language.attributes.markdown"
}
},
"endCaptures": {
"3": {
"name": "punctuation.definition.markdown"
}
},
"patterns": [
{
"begin": "(^|\\G)(\\s*)(.*)",
"while": "(^|\\G)(?!\\s*([`~]{3,})\\s*$)",
"contentName": "meta.embedded.block.solidity",
"patterns": [
{
"include": "source.solidity"
}
]
}
]
}
},
"scopeName": "markdown.solidity.codeblock"
}

0 comments on commit 46baf6c

Please sign in to comment.