mirror of
https://github.com/atom/atom.git
synced 2026-01-22 21:38:10 -05:00
Include $self inside heading rule
This allows emoji, links, etc. to be parsed and highlighted in headings
This commit is contained in:
@@ -30,8 +30,12 @@
|
||||
'1': 'name': 'markup.italic.gfm'
|
||||
}
|
||||
{
|
||||
'match': '^#{1,6}\\s+.+$'
|
||||
'begin': '^#{1,6}\\s+'
|
||||
'end': '$'
|
||||
'name': 'markup.heading.gfm'
|
||||
'patterns': [
|
||||
'include': '$self'
|
||||
]
|
||||
}
|
||||
{
|
||||
'match': '(\\:)([^\\:\\s]+)(\\:)'
|
||||
|
||||
@@ -71,9 +71,20 @@ describe "GitHub Flavored Markdown grammar", ->
|
||||
|
||||
it "tokenizes a ## Heading", ->
|
||||
{tokens} = grammar.tokenizeLine("# Heading 1")
|
||||
expect(tokens[0]).toEqual value: "# Heading 1", scopes: ["source.gfm", "markup.heading.gfm"]
|
||||
expect(tokens[0]).toEqual value: "# ", scopes: ["source.gfm", "markup.heading.gfm"]
|
||||
expect(tokens[1]).toEqual value: "Heading 1", scopes: ["source.gfm", "markup.heading.gfm"]
|
||||
|
||||
{tokens} = grammar.tokenizeLine("### Heading 3")
|
||||
expect(tokens[0]).toEqual value: "### Heading 3", scopes: ["source.gfm", "markup.heading.gfm"]
|
||||
expect(tokens[0]).toEqual value: "### ", scopes: ["source.gfm", "markup.heading.gfm"]
|
||||
expect(tokens[1]).toEqual value: "Heading 3", scopes: ["source.gfm", "markup.heading.gfm"]
|
||||
|
||||
it "tokenzies matches inside of headers", ->
|
||||
{tokens} = grammar.tokenizeLine("# Heading :one:")
|
||||
expect(tokens[0]).toEqual value: "# ", scopes: ["source.gfm", "markup.heading.gfm"]
|
||||
expect(tokens[1]).toEqual value: "Heading ", scopes: ["source.gfm", "markup.heading.gfm"]
|
||||
expect(tokens[2]).toEqual value: ":", scopes: ["source.gfm", "markup.heading.gfm", "string.emoji.gfm", "string.emoji.start.gfm"]
|
||||
expect(tokens[3]).toEqual value: "one", scopes: ["source.gfm", "markup.heading.gfm", "string.emoji.gfm", "string.emoji.word.gfm"]
|
||||
expect(tokens[4]).toEqual value: ":", scopes: ["source.gfm", "markup.heading.gfm", "string.emoji.gfm", "string.emoji.end.gfm"]
|
||||
|
||||
it "tokenizies an :emoji:", ->
|
||||
{tokens} = grammar.tokenizeLine("this is :no_good:")
|
||||
|
||||
Reference in New Issue
Block a user