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: 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/)
|
* [demo](http://ajaxorg.github.com/ace/)
|
||||||
in lists
|
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 "]
|
["text","test: header 1 "]
|
||||||
],[
|
],[
|
||||||
"start",
|
"start",
|
||||||
["markup.heading.1","#f"]
|
["markup.heading.1","#"],
|
||||||
|
["markup.heading","f"]
|
||||||
],[
|
],[
|
||||||
"start",
|
"start",
|
||||||
["text","test: header 2"]
|
["text","test: header 2"]
|
||||||
],[
|
],[
|
||||||
"start",
|
"start",
|
||||||
["markup.heading.2","## foo"]
|
["markup.heading.2","##"],
|
||||||
|
["markup.heading"," foo"]
|
||||||
],[
|
],[
|
||||||
"start",
|
"start",
|
||||||
["text","test: header ends with ' #'"]
|
["text","test: header ends with ' #'"]
|
||||||
],[
|
],[
|
||||||
"start",
|
"start",
|
||||||
["markup.heading.1","# # # "]
|
["markup.heading.1","#"],
|
||||||
|
["markup.heading"," # # "]
|
||||||
],[
|
],[
|
||||||
"start",
|
"start",
|
||||||
["text","test: header ends with '#'"]
|
["text","test: header ends with '#'"]
|
||||||
],[
|
],[
|
||||||
"start",
|
"start",
|
||||||
["markup.heading.1","#foo# "]
|
["markup.heading.1","#"],
|
||||||
|
["markup.heading","foo# "]
|
||||||
],[
|
],[
|
||||||
"start",
|
"start",
|
||||||
["text","test: 6+ #s is not a valid header"]
|
["text","test: 6+ #s is not a valid header"]
|
||||||
|
|
@ -41,13 +45,14 @@
|
||||||
"allowBlock"
|
"allowBlock"
|
||||||
],[
|
],[
|
||||||
"start",
|
"start",
|
||||||
["text","test links "],
|
["markup.heading.1","#"],
|
||||||
|
["markup.heading"," test links "],
|
||||||
["text","["],
|
["text","["],
|
||||||
["string","Cloud9 IDE"],
|
["string","Cloud9 IDE"],
|
||||||
["text","]("],
|
["text","]("],
|
||||||
["markup.underline","http://www.c9.io/"],
|
["markup.underline","http://www.c9.io/"],
|
||||||
["text",")"],
|
["text",")"],
|
||||||
["text"," "]
|
["markup.heading"," #"]
|
||||||
],[
|
],[
|
||||||
"listblock",
|
"listblock",
|
||||||
["markup.list","* "],
|
["markup.list","* "],
|
||||||
|
|
@ -72,4 +77,8 @@
|
||||||
["meta.tag","<"],
|
["meta.tag","<"],
|
||||||
["meta.tag.tag-name","b"],
|
["meta.tag.tag-name","b"],
|
||||||
["meta.tag.r",">"]
|
["meta.tag.r",">"]
|
||||||
|
],[
|
||||||
|
"allowBlock"
|
||||||
|
],[
|
||||||
|
"start"
|
||||||
]]
|
]]
|
||||||
|
|
@ -100,11 +100,12 @@ var MarkdownHighlightRules = function() {
|
||||||
}, { // h2
|
}, { // h2
|
||||||
token: "markup.heading.2",
|
token: "markup.heading.2",
|
||||||
regex: "^\\-+(?=\\s*$)"
|
regex: "^\\-+(?=\\s*$)"
|
||||||
}, { // header
|
}, {
|
||||||
token : function(value) {
|
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("(?:javascript|js)", "js-"),
|
||||||
github_embed("xml", "xml-"),
|
github_embed("xml", "xml-"),
|
||||||
|
|
@ -130,6 +131,15 @@ var MarkdownHighlightRules = function() {
|
||||||
include : "basic"
|
include : "basic"
|
||||||
}],
|
}],
|
||||||
|
|
||||||
|
"header" : [{
|
||||||
|
regex: "$",
|
||||||
|
next : "start"
|
||||||
|
}, {
|
||||||
|
include: "basic"
|
||||||
|
}, {
|
||||||
|
defaultToken : "markup.heading"
|
||||||
|
} ],
|
||||||
|
|
||||||
"listblock-start" : [{
|
"listblock-start" : [{
|
||||||
token : "support.variable",
|
token : "support.variable",
|
||||||
regex : /(?:\[[ x]\])?/,
|
regex : /(?:\[[ x]\])?/,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue