]> git.ipfire.org Git - thirdparty/vim.git/commit
runtime(rst): Recognise numeric footnotes [1] correctly
authorKirk Roemer <91125534+kirk-roemer@users.noreply.github.com>
Mon, 13 Oct 2025 18:30:48 +0000 (18:30 +0000)
committerChristian Brabandt <cb@256bit.org>
Mon, 13 Oct 2025 18:30:48 +0000 (18:30 +0000)
commit5485827c5f872884dab83607e89562c8db4899c4
tree04e98fb856a43a340d2ba46d9092b1a8eeeef653
parent4e9f16dd1ef8b48d4a37fde479adde1758796871
runtime(rst): Recognise numeric footnotes [1] correctly

The markup for footonotes [1] and citations [2] are almost identical.
The difference is that footnotes allow numeric values but citations
allow every valid reference name except numeric values.

The regex for matching citations currently only checks for valid
reference names but does not exclude number-only labels, thus also
matches numeric footnotes.  To match such footnotes, e.g. ``[1]`` define
the syntax rule for footnotes after the syntax rule for citations so it
gets higher precedence and matches first.

[1] https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#footnotes
[2] https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#citations

related: #18566

Signed-off-by: Kirk Roemer <91125534+kirk-roemer@users.noreply.github.com>
Signed-off-by: Marshall Ward <marshall.ward@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
runtime/syntax/rst.vim