xaizek / vimdoc2html

Converts Vim-style documentation into HTML
https://reversed.top/2016-01-13/converting-vim-doc-to-html/
GNU General Public License v3.0
8 stars 5 forks source link

Add cross-file tag linking #13

Open tekknolagi opened 8 months ago

tekknolagi commented 8 months ago

Nice tool! I am writing this because it would help me use this in the future but it is not by any means something I absolutely need. Just a nice-to-have/idea.

Say I have two files, a.txt and b.txt:

*a.txt*

                            *{myAlink}*
blah blah blah how to use tool A. kind of like tool {myBlink}

 vim:tw=78:ts=8:noet:ft=help:norl:
*b.txt*

                            *{myBlink}*
blah blah blah how to use tool B. kind of like tool {myAlink}

 vim:tw=78:ts=8:noet:ft=help:norl:

If I generate HTML from a.txt and b.txt, unfortunately the link to a.txt's {myAlink} from b.txt links to the file it's in (b.txt) and vice-versa.

It would be nice if this tool supported inter-file linking.

xaizek commented 8 months ago

I wanted to add some way to handle unresolved references so plugin's documentation could link to Vim's documentation at https://vimhelp.org/. This seems related to inter-file linking in that the tool needs to know which URL to use for which tag.

If all files are in the same directory, then the tags file generated in the process has some mapping, but input file names might not match output file names and you still need to derive URL somehow. This also forces copying files to one location. So maybe could specify unresolved-tag-regexp -> URL pairs in parameters for maximally flexible configuration.

tekknolagi commented 8 months ago

I mean if we're going for a.txt to a.txt.html (which seems to be the default), that's not terribly tricky to match input->output. Or am I missing something else?

xaizek commented 8 months ago

That's the default, but you can always rename the file afterward or pass -o,--output option (new, not yet mentioned in the README). And there is no guarantee that's how files are named when accessed on the server. So this needs to be more flexible than just appending .html to be generally useful.