1

I hate long comments in C source code, so where absolutely needed, I want to put single-line comments with a file:// URI pointing to the explanation (chapter or a page in the documentation). This already works with the PDF (source), but what I really need is this to work for Markdown documents.


From the link that I posted I know it's possible to create a URI that points to a PDF page e.g.:

http://www.example.com/myfile.pdf#page=4

or a PDF chapter:

http://www.example.com/myfile.pdf#glossary

Vim's g + x does not work with this, but there is a fix on the way (here):

Is there a similar way for URI to point to a Markdown chapter or Markdown page (I doubt the last one)?


If this is not possible... is there a Vim plugin that enables something like that?

71GA
  • 1,132
  • 6
  • 36
  • 69
  • 1
    Are you linking to the Markdown text document, or the rendered HTML document? If the former, then no, that is not possible. If the latter, then see [How to link to part of the same document in Markdown?](https://stackoverflow.com/questions/2822089). – Waylan Feb 19 '21 at 18:57
  • I want to link to the source document i.e. text document. Normally with suffix `.md`. Well if this is not possible I sure think that we need this in the future. – 71GA Feb 19 '21 at 19:00
  • 1
    Markdown files are just plain text files. Any such "feature" would need to be implemented by the application you are using to view the file. I suppose some text editors could provide a method to link (or jump) to a header just as they may provide a method to jump to a function/class definition in source code. But that feature would be unique to the specific editor and/or plugin you are using. And that means your question boils down to a request for a software recommendation, which is off-topic here. – Waylan Feb 19 '21 at 19:08
  • Okay. Nice explanation. So I need a software preferably VIM or a VIM plugin to implement such features. – 71GA Feb 19 '21 at 20:47
  • 1
    Waylan, Vim has some kind of feature to link to part of a text file, I think; because the files I get with `:help` have links I can follow with `ctrl-]`. But I do not know how it works. I am naively thinking there must be a bookmarking tag you can put in the markdown file, that would let Vim jump there. But it probably would not make sense when the .md file is rendered to HTML. Maybe it could be inside a comment? I will try to figure it out this weekend. – m_mlvx Feb 20 '21 at 06:59
  • @m_mlvx Have you figured out this one already? Could you point me to some useful source? – 71GA Mar 04 '21 at 21:34

0 Answers0