kakoune/rc/filetype/asciidoc.kak
Frank LENORMAND 37706d7a95 colors: Retire the bold and italic faces
This commit removes declarations and mentions to the built-in `bold`
and `italic` faces.

While they could be a user-friendly way of customising how tokens
are emphasised in Markdown documents (similarly to the
`$LESS_TERMCAP_*` environment variables for `man` pagers), most other
markup languages do not have the concept of "strong" and "emphasis"
but refer directly to the font style/weight.

The faces were also not even set by default to highlight as their
names implied, so having markup language support scripts directly
use the +b and +i face attributes is more consistent.
2020-05-15 11:56:38 +03:00

50 lines
1.8 KiB
Plaintext

# http://asciidoc.org/
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
# Detection
# ‾‾‾‾‾‾‾‾‾
hook global BufCreate .+\.(a(scii)?doc|asc) %{
set-option buffer filetype asciidoc
}
# Initialization
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
hook -group asciidoc-highlight global WinSetOption filetype=asciidoc %{
require-module asciidoc
add-highlighter window/asciidoc ref asciidoc
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/asciidoc }
}
provide-module asciidoc %{
# Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter shared/asciidoc group
add-highlighter shared/asciidoc/ regex (\A|\n\n)[^\n]+\n={2,}\h*$ 0:title
add-highlighter shared/asciidoc/ regex (\A|\n\n)[^\n]+\n-{2,}\h*$ 0:header
add-highlighter shared/asciidoc/ regex (\A|\n\n)[^\n]+\n~{2,}\h*$ 0:header
add-highlighter shared/asciidoc/ regex (\A|\n\n)[^\n]+\n\^{2,}\h*$ 0:header
add-highlighter shared/asciidoc/ regex (\A|\n\n)=\h+[^\n]+$ 0:title
add-highlighter shared/asciidoc/ regex (\A|\n\n)={2,}\h+[^\n]+$ 0:header
add-highlighter shared/asciidoc/ regex ^\h+([-\*])\h+[^\n]*(\n\h+[^-\*]\S+[^\n]*)*$ 0:list 1:bullet
add-highlighter shared/asciidoc/ regex ^(-{3,})\n[^\n\h].*?\n(-{3,})$ 0:block
add-highlighter shared/asciidoc/ regex ^(={3,})\n[^\n\h].*?\n(={3,})$ 0:block
add-highlighter shared/asciidoc/ regex ^(~{3,})\n[^\n\h].*?\n(~{3,})$ 0:block
add-highlighter shared/asciidoc/ regex ^(\*{3,})\n[^\n\h].*?\n(\*{3,})$ 0:block
add-highlighter shared/asciidoc/ regex \B(?:\+[^\n]+?\+|`[^\n]+?`)\B 0:mono
add-highlighter shared/asciidoc/ regex \b_[^\n]+?_\b 0:+i
add-highlighter shared/asciidoc/ regex \B\*[^\n]+?\*\B 0:+b
add-highlighter shared/asciidoc/ regex ^:[-\w]+: 0:meta
# Commands
# ‾‾‾‾‾‾‾‾
}