Skip to content

Commit dd62586

Browse files
committed
Update links
1 parent fa67fdc commit dd62586

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ This way, plugin authors will have to write documentation just once ( for exampl
1515
Writing vim documentation requires conforming to a few simple rules.
1616
Although `vimdoc` is not a well defined spec, vim does have some nice syntax highlighting and features like tags and links when the text file is in `vimdoc` compatible format and when `filetype=help` in vim.
1717
Also, typically, while vim documentation are just plain text files, they are usually formatted well using whitespace.
18-
See <https://vimhelp.org/helphelp.txt.html#help-writing> or [@nanotree's project](https://github.com/nanotee/vimdoc-notes) for more information.
18+
See <https://vimhelp.org/helphelp.txt.html#help-writing> or [`@nanotree`'s project](https://github.com/nanotee/vimdoc-notes) for more information.
1919
I think preserving these features and characteristics of vimdoc for documentation of vim plugins is important.
2020

2121
Writing documentation in Markdown and converting it to vimdoc is not a novel idea.
22-
[@mjlbach](https://github.com/mjlbach) has already implemented a neovim treesitter based markdown to vimdoc converter that works fairly well.
22+
[`@mjlbach`](https://github.com/mjlbach){#reference} has already implemented a neovim treesitter based markdown to vimdoc converter that works fairly well.
2323
See [mjlbach/babelfish.nvim](https://github.com/mjlbach/babelfish.nvim) for more information.
2424
This approach is close to ideal. There are no dependencies ( except for the Markdown treesitter parser ). While it appears that the markdown parser may cause crashes, I have not experienced any issues in my use. It is neovim only but you can use this on github actions even for a vim plugin documentation.
2525

scripts/panvimdoc.lua

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,10 @@ function Strikeout(s)
203203
end
204204

205205
function Link(s, tgt, tit, attr)
206-
-- links[#links + 1] = { stringify(meta.project) .. "-" .. s:gsub("%s", "-"), tgt }
207-
if string.starts_with(tgt, "https://neovim.io/doc/") then
206+
if attr.id == "reference" then
207+
links[#links + 1] = { stringify(meta.project) .. "-" .. s:gsub("%s", "-"), tgt }
208+
return "|" .. stringify(meta.project) .. "-" .. s:gsub("%s", "-") .. "|"
209+
elseif string.starts_with(tgt, "https://neovim.io/doc/") then
208210
if string.starts_with(s, "`") and string.ends_with(s, "`") then
209211
return "|" .. s .. "|"
210212
else

0 commit comments

Comments
 (0)