Skip to content

Commit

Permalink
rc markdown: Highlight trailing spaces properly
Browse files Browse the repository at this point in the history
This commit addresses the following issues:

* highlight trailing space characters with the `meta` face, instead of
  `PrimarySelection`
* make the regex more readable by using a capture group in stead of
  `\K`
* specifically match space characters, not other horizontal whitespace
  characters
* match two or more space characters

Reference[1]:

> When you do want to insert a <br /> break tag using Markdown, you
> end a line with two or more spaces, then type return.

[1] https://daringfireball.net/projects/markdown/syntax#p

Note that the original reproducer doesn't seem to work anymore,
probably because of changes made to how lists are highlighted.

Fixes #911
  • Loading branch information
lenormf committed Sep 1, 2020
1 parent 6c85c0c commit 3145e3e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion rc/filetype/markdown.kak
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ add-highlighter shared/markdown/inline/text/ regex (?<!_)(__([^\s_]|([^\s_](\n?[
add-highlighter shared/markdown/inline/text/ regex <(([a-z]+://.*?)|((mailto:)?[\w+-]+@[a-z]+[.][a-z]+))> 0:link
add-highlighter shared/markdown/inline/text/ regex ^\[[^\]\n]*\]:\h*([^\n]*) 1:link
add-highlighter shared/markdown/inline/text/ regex ^\h*(>\h*)+ 0:comment
add-highlighter shared/markdown/inline/text/ regex \H\K\h\h$ 0:PrimarySelection
add-highlighter shared/markdown/inline/text/ regex "\H( {2,})$" 1:+r@meta

# Inline code
add-highlighter shared/markdown/inline/text/ regex "^ [^\n]*" 0:meta
Expand Down

0 comments on commit 3145e3e

Please sign in to comment.