Skip to content

Instantly share code, notes, and snippets.

@extratone
Created August 31, 2025 19:54
Show Gist options
  • Save extratone/e5d3582de3eb77379791a2f2f06dfccd to your computer and use it in GitHub Desktop.
Save extratone/e5d3582de3eb77379791a2f2f06dfccd to your computer and use it in GitHub Desktop.
{
"name": "CommonMark",
"description": "A syntax definition for CommonMark, based on the official specification.",
"author": "Gemini",
"sampleText": "# CommonMark\n\nThis is a sample text for the CommonMark syntax definition.\n\n- Lists\n- *Emphasis*\n- **Strong**\n\n```\nCode blocks\n```",
"rangeExtensionType": {
"default": "lineExtended"
},
"patterns": [
{
"comment": "ATX Headings",
"match": "^(#{1,6}) (.*)$",
"exclusive": true,
"captures": {
"1": {
"scope": "markup.heading"
},
"2": {
"scope": "text.heading"
}
}
},
{
"comment": "Setext Headings",
"match": "^(.+)\n(=+|-+)$",
"exclusive": true,
"captures": {
"1": {
"scope": "text.heading"
},
"2": {
"scope": "markup.heading"
}
}
},
{
"comment": "Thematic Breaks",
"match": "^(_{3,}|\*{3,}|-{3,})$",
"exclusive": true,
"captures": {
"1": {
"scope": "markup"
}
}
},
{
"comment": "Fenced Code Blocks",
"match": "^(```|~~~)(.*)$\n([\s\S]*?)^(\\1)$",
"exclusive": true,
"captures": {
"1": {
"scope": "markup.code"
},
"2": {
"scope": "text.code.language"
},
"3": {
"scope": "text.code"
},
"4": {
"scope": "markup.code"
}
}
},
{
"comment": "Indented Code Blocks",
"match": "^( |\t)(.*)$",
"exclusive": true,
"captures": {
"1": {
"scope": "markup.code"
},
"2": {
"scope": "text.code"
}
}
},
{
"comment": "Blockquotes",
"match": "^(>+)(.*)$",
"exclusive": false,
"captures": {
"1": {
"scope": "markup.quote"
},
"2": {
"scope": "text.quote"
}
}
},
{
"comment": "Unordered Lists",
"match": "^([\*\+\-]) (.*)$",
"exclusive": false,
"captures": {
"1": {
"scope": "markup.list"
},
"2": {
"scope": "text.list"
}
}
},
{
"comment": "Ordered Lists",
"match": "^(\d+\.) (.*)$",
"exclusive": false,
"captures": {
"1": {
"scope": "markup.list"
},
"2": {
"scope": "text.list"
}
}
},
{
"comment": "Links",
"match": "(!?)\[([^\]]+)\]\(([^\]]+)\)",
"exclusive": false,
"captures": {
"1": {
"scope": "markup.link"
},
"2": {
"scope": "text.link"
},
"3": {
"scope": "text.url"
}
}
},
{
"comment": "Strong Emphasis",
"match": "(\*\*|__)(.*?)\1",
"exclusive": false,
"captures": {
"1": {
"scope": "markup.strong"
},
"2": {
"scope": "text.strong"
}
}
},
{
"comment": "Emphasis",
"match": "(\*|_)(.*?)\1",
"exclusive": false,
"captures": {
"1": {
"scope": "markup.emphasis"
},
"2": {
"scope": "text.emphasis"
}
}
},
{
"comment": "Code Spans",
"match": "`([^"]+)`",
"exclusive": true,
"captures": {
"1": {
"scope": "text.code"
}
}
},
{
"comment": "HTML Blocks",
"match": "<([a-zA-Z0-9]+)([^>]*)>([\s\S]*?)<\/\1>",
"exclusive": true,
"captures": {
"0": {
"scope": "text.html"
}
}
}
],
"navigationPatterns": [
{
"match": "^# (.*)$",
"comment": "H1 level markdown headers with #",
"rangeCapture": "0",
"labelCapture": "1",
"prefix": "H1",
"level": 0
},
{
"match": "^## (.*)$",
"comment": "H2 level markdown headers with ##",
"rangeCapture": "0",
"labelCapture": "1",
"prefix": "H2",
"level": 1
},
{
"match": "^### (.*)$",
"comment": "H3 level markdown headers with ###",
"rangeCapture": "0",
"labelCapture": "1",
"prefix": "H3",
"level": 2
},
{
"match": "^#### (.*)$",
"comment": "H4 level markdown headers with ####",
"rangeCapture": "0",
"labelCapture": "1",
"prefix": "H4",
"level": 3
},
{
"match": "^##### (.*)$",
"comment": "H5 level markdown headers with #####",
"rangeCapture": "0",
"labelCapture": "1",
"prefix": "H5",
"level": 4
},
{
"match": "^###### (.*)$",
"comment": "H6 level markdown headers with ######",
"rangeCapture": "0",
"labelCapture": "1",
"prefix": "H6",
"level": 5
}
],
"indentationPatterns": [
{
"match": "(^\h*\* |^\h*\- |^\h*\+ |^\h*\d+\. |^\h*>[> ]+).*",
"comment": "Indent Markdown lists and blockquotes",
"indentCapture": "1",
"indentScope": "text.normal"
}
],
"taskMarkDefinitions": [],
"linkDefinitions": [],
"autocompleteDefinitions": [],
"listCompletionDefinitions": []
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment