doc.kak: stricter parsing of formatted text

Format markers such as *, _ or ` must be followed/preceeded by a non
whitespace character to be considered formatting marker.
This commit is contained in:
Maxime Coste 2018-02-22 22:22:13 +11:00
parent 026cf8af3a
commit e93c31ff0d

View File

@ -101,9 +101,9 @@ define-command -params 1 -hidden doc-render %{
# Setup the doc_render_ranges option # Setup the doc_render_ranges option
set-option buffer doc_render_ranges %val{timestamp} set-option buffer doc_render_ranges %val{timestamp}
doc-render-regex \B(?<!\\)\*[^\n]+?(?<!\\)\*\B \A|.\z 'H' default+b doc-render-regex \B(?<!\\)\*(?=\S)[^\n]+?(?<=\S)(?<!\\)\*\B \A|.\z 'H' default+b
doc-render-regex \b(?<!\\)_[^\n]+?(?<!\\)_\b \A|.\z 'H' default+i doc-render-regex \b(?<!\\)_(?=\S)[^\n]+?(?<=\S)(?<!\\)_\b \A|.\z 'H' default+i
doc-render-regex \B(?<!\\)`[^\n]+?(?<!\\)`\B \A|.\z 'H' mono doc-render-regex \B(?<!\\)`(?=\S)[^\n]+?(?<=\S)(?<!\\)`\B \A|.\z 'H' mono
doc-render-regex ^=\h+[^\n]+ ^=\h+ '~' title doc-render-regex ^=\h+[^\n]+ ^=\h+ '~' title
doc-render-regex ^={2,}\h+[^\n]+ ^={2,}\h+ '' header doc-render-regex ^={2,}\h+[^\n]+ ^={2,}\h+ '' header
doc-render-regex ^-{2,}\n.*?^-{2,}\n ^-{2,}\n '' block doc-render-regex ^-{2,}\n.*?^-{2,}\n ^-{2,}\n '' block