Require non-asterix in bold and italic matches

This commit is contained in:
Kevin Sawicki
2013-02-09 16:32:27 -08:00
parent 20d68a380f
commit 659b7e05a0
2 changed files with 8 additions and 2 deletions

View File

@@ -9,11 +9,11 @@
]
'patterns': [
{
'match': '\\*\\*.*\\*\\*'
'match': '\\*\\*[^\\*]+\\*\\*'
'name': 'markup.bold.gfm'
}
{
'match': '\\*.*\\*'
'match': '\\*[^\\*]+\\*'
'name': 'markup.italic.gfm'
}
{

View File

@@ -14,12 +14,18 @@ describe "GitHub Flavored Markdown grammar", ->
expect(grammar.scopeName).toBe "source.gfm"
it "tokenizes **bold** text", ->
{tokens} = grammar.tokenizeLine("****")
expect(tokens[0]).toEqual value: "****", scopes: ["source.gfm"]
{tokens} = grammar.tokenizeLine("this is **bold** text")
expect(tokens[0]).toEqual value: "this is ", scopes: ["source.gfm"]
expect(tokens[1]).toEqual value: "**bold**", scopes: ["source.gfm", "markup.bold.gfm"]
expect(tokens[2]).toEqual value: " text", scopes: ["source.gfm"]
it "tokenizes *italic* text", ->
{tokens} = grammar.tokenizeLine("**")
expect(tokens[0]).toEqual value: "**", scopes: ["source.gfm"]
{tokens} = grammar.tokenizeLine("this is *italic* text")
expect(tokens[0]).toEqual value: "this is ", scopes: ["source.gfm"]
expect(tokens[1]).toEqual value: "*italic*", scopes: ["source.gfm", "markup.italic.gfm"]