fix link highlighting in markdown headers
This commit is contained in:
parent
77b5ae1062
commit
df706e5706
3 changed files with 31 additions and 11 deletions
|
|
@ -12,8 +12,9 @@ test: # followed be only space is not a valid header
|
|||
test: only space between #s is not a valid header
|
||||
# #
|
||||
|
||||
test links [Cloud9 IDE](http://www.c9.io/)
|
||||
# test links [Cloud9 IDE](http://www.c9.io/) #
|
||||
* [demo](http://ajaxorg.github.com/ace/)
|
||||
in lists
|
||||
|
||||
in plain text <b>http://ace.ajaxorg.com<b>
|
||||
in plain text <b>http://ace.ajaxorg.com<b>
|
||||
|
||||
|
|
|
|||
|
|
@ -3,25 +3,29 @@
|
|||
["text","test: header 1 "]
|
||||
],[
|
||||
"start",
|
||||
["markup.heading.1","#f"]
|
||||
["markup.heading.1","#"],
|
||||
["markup.heading","f"]
|
||||
],[
|
||||
"start",
|
||||
["text","test: header 2"]
|
||||
],[
|
||||
"start",
|
||||
["markup.heading.2","## foo"]
|
||||
["markup.heading.2","##"],
|
||||
["markup.heading"," foo"]
|
||||
],[
|
||||
"start",
|
||||
["text","test: header ends with ' #'"]
|
||||
],[
|
||||
"start",
|
||||
["markup.heading.1","# # # "]
|
||||
["markup.heading.1","#"],
|
||||
["markup.heading"," # # "]
|
||||
],[
|
||||
"start",
|
||||
["text","test: header ends with '#'"]
|
||||
],[
|
||||
"start",
|
||||
["markup.heading.1","#foo# "]
|
||||
["markup.heading.1","#"],
|
||||
["markup.heading","foo# "]
|
||||
],[
|
||||
"start",
|
||||
["text","test: 6+ #s is not a valid header"]
|
||||
|
|
@ -41,13 +45,14 @@
|
|||
"allowBlock"
|
||||
],[
|
||||
"start",
|
||||
["text","test links "],
|
||||
["markup.heading.1","#"],
|
||||
["markup.heading"," test links "],
|
||||
["text","["],
|
||||
["string","Cloud9 IDE"],
|
||||
["text","]("],
|
||||
["markup.underline","http://www.c9.io/"],
|
||||
["text",")"],
|
||||
["text"," "]
|
||||
["markup.heading"," #"]
|
||||
],[
|
||||
"listblock",
|
||||
["markup.list","* "],
|
||||
|
|
@ -72,4 +77,8 @@
|
|||
["meta.tag","<"],
|
||||
["meta.tag.tag-name","b"],
|
||||
["meta.tag.r",">"]
|
||||
],[
|
||||
"allowBlock"
|
||||
],[
|
||||
"start"
|
||||
]]
|
||||
|
|
@ -100,11 +100,12 @@ var MarkdownHighlightRules = function() {
|
|||
}, { // h2
|
||||
token: "markup.heading.2",
|
||||
regex: "^\\-+(?=\\s*$)"
|
||||
}, { // header
|
||||
}, {
|
||||
token : function(value) {
|
||||
return "markup.heading." + value.search(/[^#]/);
|
||||
return "markup.heading." + value.length;
|
||||
},
|
||||
regex : "^#{1,6}(?:[^ #].*| +.*(?:[^ #].*|[^ ]+.* +#+ *))$"
|
||||
regex : /^#{1,6}(?=\s*[^ #]|\s+#.)/,
|
||||
next : "header"
|
||||
},
|
||||
github_embed("(?:javascript|js)", "js-"),
|
||||
github_embed("xml", "xml-"),
|
||||
|
|
@ -129,6 +130,15 @@ var MarkdownHighlightRules = function() {
|
|||
}, {
|
||||
include : "basic"
|
||||
}],
|
||||
|
||||
"header" : [{
|
||||
regex: "$",
|
||||
next : "start"
|
||||
}, {
|
||||
include: "basic"
|
||||
}, {
|
||||
defaultToken : "markup.heading"
|
||||
} ],
|
||||
|
||||
"listblock-start" : [{
|
||||
token : "support.variable",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue