Fix highlight references in Markdown fenced code blocks

Fixes #1735

We need \K to not interfer with languages own interpretation of ` like multiline strings in javascript

We need \b in e.g. java\b otherwise it blocks javascript

I couldn't get the bare ``` to not block the other highlighters when introducing \K any other way than negative lookahead of all possible highlighers
This commit is contained in:
Dan Rosén 2017-12-10 22:56:47 +01:00
parent 19556d5fbe
commit 5bc62c6942

View File

@ -12,51 +12,52 @@ hook global BufCreate .*[.](markdown|md|mkd) %{
# ‾‾‾‾‾‾‾‾‾‾‾‾ # ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter shared/ regions -default content markdown \ add-highlighter shared/ regions -default content markdown \
c ```\h*c ``` '' \ c ^```\h*c\b\K ``` '' \
cabal ```\h*cabal ``` '' \ cabal ^```\h*cabal\b\K ``` '' \
clojure ```\h*clojure ``` '' \ clojure ^```\h*clojure\b\K ``` '' \
coffee ```\h*coffee ``` '' \ coffee ^```\h*coffee\b\K ``` '' \
cpp ```\h*cpp ``` '' \ cpp ^```\h*cpp\b\K ``` '' \
css ```\h*css ``` '' \ css ^```\h*css\b\K ``` '' \
cucumber ```\h*cucumber ``` '' \ cucumber ^```\h*cucumber\b\K ``` '' \
d ```\h*d ``` '' \ d ^```\h*d\b\K ``` '' \
diff ```\h*diff ``` '' \ diff ^```\h*diff\b\K ``` '' \
dockerfile ```\h*dockerfile ``` '' \ dockerfile ^```\h*dockerfile\b\K ``` '' \
fish ```\h*fish ``` '' \ fish ^```\h*fish\b\K ``` '' \
gas ```\h*gas ``` '' \ gas ^```\h*gas\b\K ``` '' \
go ```\h*go ``` '' \ go ^```\h*go\b\K ``` '' \
haml ```\h*haml ``` '' \ haml ^```\h*haml\b\K ``` '' \
haskell ```\h*haskell ``` '' \ haskell ^```\h*haskell\b\K ``` '' \
html ```\h*html ``` '' \ html ^```\h*html\b\K ``` '' \
ini ```\h*ini ``` '' \ ini ^```\h*ini\b\K ``` '' \
java ```\h*java ``` '' \ java ^```\h*java\b\K ``` '' \
javascript ```\h*javascript ``` '' \ javascript ^```\h*javascript\b\K ``` '' \
json ```\h*json ``` '' \ json ^```\h*json\b\K ``` '' \
julia ```\h*julia ``` '' \ julia ^```\h*julia\b\K ``` '' \
kak ```\h*kak ``` '' \ kak ^```\h*kak\b\K ``` '' \
kickstart ```\h*kickstart ``` '' \ kickstart ^```\h*kickstart\b\K ``` '' \
latex ```\h*latex ``` '' \ latex ^```\h*latex\b\K ``` '' \
lisp ```\h*lisp ``` '' \ lisp ^```\h*lisp\b\K ``` '' \
lua ```\h*lua ``` '' \ lua ^```\h*lua\b\K ``` '' \
makefile ```\h*makefile ``` '' \ makefile ^```\h*makefile\b\K ``` '' \
moon ```\h*moon ``` '' \ moon ^```\h*moon\b\K ``` '' \
objc ```\h*objc ``` '' \ objc ^```\h*objc\b\K ``` '' \
perl ```\h*perl ``` '' \ perl ^```\h*perl\b\K ``` '' \
pug ```\h*pug ``` '' \ pug ^```\h*pug\b\K ``` '' \
python ```\h*python ``` '' \ python ^```\h*python\b\K ``` '' \
ragel ```\h*ragel ``` '' \ ragel ^```\h*ragel\b\K ``` '' \
ruby ```\h*ruby ``` '' \ ruby ^```\h*ruby\b\K ``` '' \
rust ```\h*rust ``` '' \ rust ^```\h*rust\b\K ``` '' \
sass ```\h*sass ``` '' \ sass ^```\h*sass\b\K ``` '' \
scala ```\h*scala ``` '' \ scala ^```\h*scala\b\K ``` '' \
scss ```\h*scss ``` '' \ scss ^```\h*scss\b\K ``` '' \
sh ```\h*sh ``` '' \ sh ^```\h*sh\b\K ``` '' \
swift ```\h*swift ``` '' \ swift ^```\h*swift\b\K ``` '' \
tupfile ```\h*tupfile ``` '' \ tupfile ^```\h*tupfile\b\K ``` '' \
yaml ```\h*yaml ``` '' \ typescript ^```\h*typescript\b\K ``` '' \
code ``` ``` '' \ yaml ^```\h*yaml\b\K ``` '' \
code `` `` '' \ code ^```((!?=(c|cabal|clojure|coffee|cpp|css|cucumber|diff|dockerfile|fish|gas|go|haml|haskell|html|ini|java|javascript|json|julia|kakrc|kickstart|latex|lisp|lua|makefile|moon|objc|perl|pug|python|ragel|ruby|rust|sass|scala|scss|sh|swift|tupfile|typescript|yaml)[^\n])*)$ ``` '' \
code ` ` '' code ^``[^`] `` '' \
code ^`[^`] ` ''
add-highlighter shared/markdown/code fill meta add-highlighter shared/markdown/code fill meta
@ -101,6 +102,7 @@ add-highlighter shared/markdown/scss ref scss
add-highlighter shared/markdown/sh ref sh add-highlighter shared/markdown/sh ref sh
add-highlighter shared/markdown/swift ref swift add-highlighter shared/markdown/swift ref swift
add-highlighter shared/markdown/tupfile ref tupfile add-highlighter shared/markdown/tupfile ref tupfile
add-highlighter shared/markdown/typescript ref typescript
add-highlighter shared/markdown/yaml ref yaml add-highlighter shared/markdown/yaml ref yaml
# Setext-style header # Setext-style header