Skip to content

Instantly share code, notes, and snippets.

@agiletortoise
Created February 17, 2019 21:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save agiletortoise/4675e296300c2b92466f7bc389dd12ac to your computer and use it in GitHub Desktop.
Save agiletortoise/4675e296300c2b92466f7bc389dd12ac to your computer and use it in GitHub Desktop.
Drafts Markdown Def File
{
"name": "Markdown",
"description": "Basic Markdown syntax based more closely on the original Markdown specification.",
"scopeName": "text.markdown",
"rangeExtension": "lineExtended",
"listCompletion": "markdown",
"fileExtensions": [
"markdown",
"mkdown",
"md",
"mdown"
],
"uuid": "markdown",
"patterns": [
{
"match": "^(#+ )([^#\\n]*)(#*)$",
"exclusive": true,
"comment": "Markdown header like ###",
"captures": {
"1": {
"name": "markup"
},
"2": {
"name": "text.header"
},
"3": {
"name": "markup"
}
}
},
{
"match": "^(\\*{3,}|-{3,})",
"exclusive": true,
"comment": "Markdown horizontal rule like *** or ---",
"captures": {
"1": {
"name": "markup"
}
}
},
{
"match": "^( {4,}(?![->\\*\\+])|\\t{1,}(?![->\\*\\+]))(\\S+.*)",
"exclusive": true,
"comment": "Markdown code blocks starting with 4 spaces or tab",
"captures": {
"1": {
"name": "code.block"
},
"2": {
"name": "code.block"
}
}
},
{
"match": "^\\h*(\\*|\\-|\\+|\\d+\\.) ",
"exclusive": false,
"comment": "Markdown list lines starting with whitespace and -,+,*",
"captures": {
"1": {
"name": "markup"
}
}
},
{
"match": "^\\h*(>+ )(.*)",
"exclusive": false,
"comment": "Markdown quotes starting with > ",
"captures": {
"1": {
"name": "markup"
},
"2": {
"name": "text.italic"
}
}
},
{
"match": "((?<![\\\\`])(`)(?![`])([\\S?].*?)(?<![`])(`)(?![\\\\`]))",
"exclusive": true,
"comment": "Markdown inline code like `code`",
"captures": {
"2": {
"name": "markup"
},
"3": {
"name": "code.inline"
},
"4": {
"name": "markup"
}
}
},
{
"match": "((?<![\\\\\\*_])(\\*|_)(?![\\\\\\*_])([\\S?].*?)(?<![\\\\|\\*])(\\2)(?![\\\\|\\*]))",
"exclusive": false,
"comment": "Markdown emphasis like *italic* or _italic_",
"captures": {
"2": {
"name": "markup"
},
"3": {
"name": "text.italic"
},
"4": {
"name": "markup"
}
}
},
{
"match": "(((?<!\\\\)\\*\\*|__)([\\S?].*?)(\\2))",
"exclusive": false,
"comment": "Markdown bold like **bold** or __bold__",
"captures": {
"2": {
"name": "markup"
},
"3": {
"name": "text.bold"
},
"4": {
"name": "markup"
}
}
},
{
"match": "(\\[)([^\\[]+)(\\])(\\()([^\\)]+)(\\))",
"exclusive": true,
"comment": "Markdown links like [text](link)",
"captures": {
"1": {
"name": "markup"
},
"3": {
"name": "markup"
},
"6": {
"name": "markup"
},
"2": {
"name": "text.link"
},
"5": {
"name": "markup"
},
"4": {
"name": "markup"
}
}
},
{
"match": "^(\\[)([^\\[]+)(\\]:) (.*)",
"exclusive": true,
"comment": "Markdown reference like [id]: link",
"captures": {
"1": {
"name": "markup"
},
"2": {
"name": "text.link"
},
"3": {
"name": "markup"
},
"4": {
"name": "markup"
}
}
},
{
"match": "(<[^>]*>)",
"exclusive": false,
"comment": "html tags",
"captures": {
"1": {
"name": "markup"
}
}
}
],
"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*>+ ).*",
"exclusive": true,
"comment": "Indent Markdown lists beginning with -,+,*",
"captures": {
"1": {
"name": "style.indentString"
}
}
}
],
"taskMarkDefinition": {
"enabled": true,
"pattern": "(\\[[ xX]\\])",
"onState": "[x]",
"offState": "[ ]",
"minSize": 50
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment