1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-11-27 02:23:26 +03:00

rc markdown: Fix fenced code blocks

The closing ``` in the following example was not detected because the
indented code block highlighter was higher up in the hierarchy than the
fenced code block highlighter:

```
    indented
```

The codeblock highlighter used to be inline so that it has an effect
inside listblocks. This commits adds a listblock/codeblock highlighter
as a replacement.

Fixes #4351
This commit is contained in:
Lennard Hofmann 2021-09-23 14:42:53 +00:00
parent 1456431951
commit 55b2b8c88d

View File

@ -55,17 +55,21 @@ evaluate-commands %sh{
done
}
add-highlighter shared/markdown/inline/codeblock region -match-capture \
^(\h*)```\h* \
^(\h*)```\h*$ \
fill meta
add-highlighter shared/markdown/codeblock region "^( {4}|\t)" "$" fill meta
add-highlighter shared/markdown/listblock region ^\h*[-*]\s ^(?=\S) regions
add-highlighter shared/markdown/listblock/g default-region group
add-highlighter shared/markdown/listblock/g/ ref markdown/inline
add-highlighter shared/markdown/listblock/g/marker regex ^\h*([-*])\s 1:bullet
add-highlighter shared/markdown/codeblock region -match-capture \
^(\h*)```\h* \
^(\h*)```\h*$ \
fill meta
add-highlighter shared/markdown/listblock/codeblock region -match-capture \
^(\h*)```\h* \
^(\h*)```\h*$ \
fill meta
add-highlighter shared/markdown/codeline region "^( {4}|\t)" "$" fill meta
# https://spec.commonmark.org/0.29/#link-destination
add-highlighter shared/markdown/angle_bracket_url region (?<=<)([a-z]+://|(mailto|magnet|xmpp):) (?!\\).(?=>)|\n fill link
add-highlighter shared/markdown/inline/url region -recurse \( ([a-z]+://|(mailto|magnet|xmpp):) (?!\\).(?=\))|\s fill link