diff --git a/grammars/julia.cson b/grammars/julia.cson index 344f91e..a3188a0 100644 --- a/grammars/julia.cson +++ b/grammars/julia.cson @@ -493,6 +493,28 @@ repository: } ] } + { + begin: '(md)(""")' + beginCaptures: + '1': + name: 'support.function.macro.julia' + '2': + name: 'punctuation.definition.string.begin.julia' + end: '([\\s\\w]*)(""")' + endCaptures: + '2': + name: 'punctuation.definition.string.end.julia' + name: 'embed.markdown.julia' + contentName: 'text.html.markdown' + patterns: [ + { + include: 'text.html.markdown' + } + { + include: '#string_dollar_sign_interpolate' + } + ] + } { begin: '(js)(""")' beginCaptures: diff --git a/grammars/julia.json b/grammars/julia.json index dd2c5df..88f59b6 100644 --- a/grammars/julia.json +++ b/grammars/julia.json @@ -559,6 +559,33 @@ } ] }, + { + "begin": "(md)(\"\"\")", + "beginCaptures": { + "1": { + "name": "support.function.macro.julia" + }, + "2": { + "name": "punctuation.definition.string.begin.julia" + } + }, + "end": "([\\s\\w]*)(\"\"\")", + "endCaptures": { + "2": { + "name": "punctuation.definition.string.end.julia" + } + }, + "name": "embed.markdown.julia", + "contentName": "text.html.markdown", + "patterns": [ + { + "include": "text.html.markdown" + }, + { + "include": "#string_dollar_sign_interpolate" + } + ] + }, { "begin": "(js)(\"\"\")", "beginCaptures": { diff --git a/grammars/julia_vscode.json b/grammars/julia_vscode.json index 8bc97f1..f240f31 100644 --- a/grammars/julia_vscode.json +++ b/grammars/julia_vscode.json @@ -559,6 +559,33 @@ } ] }, + { + "begin": "(md)(\"\"\")", + "beginCaptures": { + "1": { + "name": "support.function.macro.julia" + }, + "2": { + "name": "punctuation.definition.string.begin.julia" + } + }, + "end": "([\\s\\w]*)(\"\"\")", + "endCaptures": { + "2": { + "name": "punctuation.definition.string.end.julia" + } + }, + "name": "embed.markdown.julia", + "contentName": "text.html.markdown", + "patterns": [ + { + "include": "text.html.markdown" + }, + { + "include": "#string_dollar_sign_interpolate" + } + ] + }, { "begin": "(js)(\"\"\")", "beginCaptures": { diff --git a/test/test.js b/test/test.js index 37e3bd1..0a2eab9 100644 --- a/test/test.js +++ b/test/test.js @@ -1787,6 +1787,27 @@ describe('Julia grammar', function () { }, ]) }) + it("tokenizes markdown multiline string macros", function () { + const tokens = tokenize(grammar, 'md"""\nTest\n"""') + compareTokens(tokens, [ + { + value: 'md', + scopes: ["embed.markdown.julia", "support.function.macro.julia"] + }, + { + value: '"""', + scopes: ["embed.markdown.julia", "punctuation.definition.string.begin.julia"] + }, + { + value: '\nTest\n', + scopes: ["embed.markdown.julia"] + }, + { + value: '"""', + scopes: ["embed.markdown.julia", "punctuation.definition.string.end.julia"] + }, + ]) + }) it("tokenizes js multiline string macros", function () { const tokens = tokenize(grammar, 'js"""\nvar foo = function () {return x}\n"""') compareTokens(tokens, [