Skip to content

Commit

Permalink
fixup: delimiters
Browse files Browse the repository at this point in the history
  • Loading branch information
clason committed Jun 1, 2024
1 parent bf52536 commit 8608da5
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 30 deletions.
2 changes: 1 addition & 1 deletion grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ module.exports = grammar({
// TODO: children should be $.word (plaintext), not $.atom.
column_heading: ($) => seq(
alias(seq(choice($._atom_noli, $._uppercase_words), repeat($._atom)), $.heading),
'~',
alias('~', $.delimiter),
token.immediate('\n'),
),

Expand Down
16 changes: 11 additions & 5 deletions queries/vimdoc/highlights.scm
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
(h1) @markup.heading.1
(h1
(delimiter) @markup.heading.1
(heading) @markup.heading.1)

(h2) @markup.heading.2
(h2
(delimiter) @markup.heading.2
(heading) @markup.heading.2)

(h3) @markup.heading.3
(h3
(heading) @markup.heading.3)

(column_heading) @markup.heading.4
(column_heading
(heading) @markup.heading.4)

(column_heading
"~" @markup.heading.4.marker
(delimiter) @markup.heading.4.marker
(#set! conceal ""))

(tag
Expand Down
19 changes: 10 additions & 9 deletions src/grammar.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions src/node-types.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions src/parser.c

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 10 additions & 5 deletions test/corpus/heading3-column_heading.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ Text
(column_heading
(heading
(word)
(word))))
(word))
(delimiter)))
(line
(word))))

Expand Down Expand Up @@ -83,7 +84,8 @@ Below
(line
(column_heading
(heading
(word)))))
(word))
(delimiter))))
(block
(line
(word))))
Expand Down Expand Up @@ -127,7 +129,8 @@ nvim_ui_try_resize({width}, {height}) *nvim_ui_try_resize()*
(heading
(word))
(heading
(word)))))
(word))
(delimiter))))
(block
(line
(word)
Expand All @@ -147,7 +150,8 @@ nvim_ui_try_resize({width}, {height}) *nvim_ui_try_resize()*
(line
(column_heading
(heading
(word))))
(word))
(delimiter)))
(line
(taglink
(word))
Expand Down Expand Up @@ -181,7 +185,8 @@ column_heading should NOT parse atoms (links, tags, etc.) (FIXME)
(heading
(word)
(optionlink
(word))))))
(word)))
(delimiter))))
(block
(line
(word))))
Expand Down

0 comments on commit 8608da5

Please sign in to comment.