| Crates.io | tree-sitter-vimdoc |
| lib.rs | tree-sitter-vimdoc |
| version | 4.1.0 |
| created_at | 2025-12-08 18:36:52.617252+00 |
| updated_at | 2025-12-15 08:29:49.525788+00 |
| description | Tree-sitter grammar for Vim help files |
| homepage | |
| repository | https://github.com/neovim/tree-sitter-vimdoc |
| max_upload_size | |
| id | 1974200 |
| size | 633,441 |
This grammar implements the vimdoc "spec" (ref1, ref2). Predictable results are the primary goal, so that output formats (e.g. HTML) are well-formed; the input (vimdoc) is secondary. The first step should always be to try to fix the input rather than insist on a grammar that handles vimdoc's endless quirks.
block is the main top-level node, delimited by blank line(s) or any line
starting with < (codeblock terminator).
line and line_li nodes.line:
h1, h2, h3, column_heading) because codeblock
terminated by "implicit stop" (no terminating <) consumes blank lines, so
block has no way to end.line_li ("listitem")
-/•/[0-9]. (not +/*) are listitems.prefix node to detect if the listitem is ordered (numbered) or
unodered.codeblock:
line or line_li, because ">" can start a codeblock at the
end of any line.line nodes without word nodes: it's just the full raw text
line including whitespace. This is somewhat dictated by its "preformatted"
nature; parsing the contents would require loading a "child" language
(injection). See #2.< (and any following whitespace) is discarded (anonymous).url intentionally does not capture .,) at the end of the URL. See also Known issues.h1 = "Heading 1": ====== followed by text and optional *tags*.h2 = "Heading 2": ------ followed by text and optional *tags*.h3 = "Heading 3": UPPERCASE WORDS, followed by optional *tags*, followed
by atoms.\n). Grammar does not support files without EOL.1. (or other number) is treated as a listitem, even
if the first line of its block is not a listitem. Example:
Foo was 0, not
1. Uh oh.
codeblock delimiter ">" must be preceded by a space
(" >"), not a tab. But currently the grammar doesn't enforce this. Example:
:help lcs-tab.url cannot contain a closing bracket ] anywhere in the URL. (Workaround:
URL-encode the bracket.) This is a tradeoff so that markdown hyperlinks work:
[https://example.com](https://example.com)
column_heading currently only recognizes tilde ~ preceded by space (i.e.
foo ~ not foo~). This covers 99% of :help files.column_heading children should be plaintext, but currently are parsed as $._atom.modeline must be preceded by a blank line.h4 ("tag heading") : a line containing only tags, or ending with a tag, is
a "h4" heading.Steps to perform a release: https://tree-sitter.github.io/tree-sitter/creating-parsers/6-publishing.html
npm install tree-sitter-cli
tree-sitter version x.y.z
patch/minor/major to indicate query compatibility:
patch for bugfixes (no changes to queries needed)minor for added nodes (queries may need changes to use new nodes but will not error)major for removed or renamed nodes (queries will error if not adapted), other breaking changestree-sitter generate && tree-sitter test
git add .
git commit -m 'release'
git push
Crate: https://crates.io/crates/tree-sitter-vimdoc
cargo publish --dry-run
cargo login
cargo publish