spec: formal vimdoc specification document #61
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
barrettruth/vimdoc-language-server#61
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
The formatter, diagnostics, and parser all enforce implicit rules about what
valid vimdoc looks like — but those rules are nowhere written down
prescriptively. This blocks spec-enforcement diagnostics and makes it
impossible to confidently answer "is this correct vimdoc?"
Empirical grounding
The corpus work on 135 Neovim 0.12 runtime help files provides ground truth:
tw=78is universal; 96.2% of prose lines already fitts=8; tab characters are structural (command-referencecolumn alignment), not prose whitespace
./?/!is a live convention(confirmed in
api.txtand others)=or-repeated ≥10 times on its own line;threshold avoids false-positives on things like
-- commentor optionstrings
>(trailing on a prose line) and>language(aloneon its own line) start code blocks; blank line or
<ends them; anunindented non-
<line also ends the block-,*,•(unordered) andN.(ordered);* tag *without adjacent space is a tag definition, not a list item
Scope
A prescriptive spec document (
docs/spec.md) covering:*tag*),code blocks, list items, blank lines
*tag*), tag references (|taglink|),code spans (
`code`), tab-aligned columnstw=78,ts=8, sentence spacing, trailingwhitespace
* tag *vs list item,->not a fence, orderedlist vs TOC heading annotation, valid taglink syntax (no spaces, no pipe
inside backtick span)
(and its diagnostic implications),
>languagecode fence, pipe charactersin prose that are not taglinks
Prerequisite for
invalid code fence syntax)
definition of what constitutes a valid taglink
I was skeptical of this assertion. In
api.txtspecifically, there are only 8 instances of double spaces, but 396 instances of single spaces.I wrote a bash script to get some actual statistics (uses
rg,awk, andmlr):Click to view stats
file: help filedouble: number of double spaces after./?/!single: number of single spaces after./?/!%double: percentage of double spaces out of the total (100 * $double / ($double + $single))Totals:
So, yeah, there are slightly more double spaces than there are single spaces.
Yes. thanks for this commentary; busy with school but all of these standards need to be set.
I was very surprised by the "typewriter-esque" style spacing.
sigh... just complicates everything just a bit more 😭
thinking of making a report that canonicalizes all sorts of statistics and visualizes them like exacty what you just did - great stuff.
Possibly interesting observation: It seems like the number of double spaces after a sentence is related to how old the help files are. For example, all the user manual files (
usr_*.txt) have a high percentage of double spaces (lowest percentage is 78%, almost half of them are over 90%). But, I never studied statistics, and I could be just be misreading it 🤷♂️There should probably be a difference between the specification, and a style guide/formatter.
Something that violates the spec would not be valid vimdoc. Something that violates the style guide would still be valid.
If you were to create a style guide, I doubt it would be adopted very widely in the plugin ecosystem, unless Neovim adopts it for the official help files. A proper style guide checker would help with that (i.e. vimdoc_ls) and so would actually opening an issue in the Neovim repo asking if the maintainers would like to start using a style guide, and if they would, what rules should be included.
yep. planning to make a post @ ing people who have been participating in the conversation for exactly that. feel free to email me br@barrettruth.com or msg on any platform (username barrettruth) if you'd like to be involved for sure.
that's an important distinction. and, im only interested in vim/neovim core for sure - the community always falls in line with these things (eventually), especially if the tooling is good enough.
also, so funny - i was intuiting that the typewriter-style spacing was indeed an old, ancient practice 💀 and it was