markdown-preview.nvim icon indicating copy to clipboard operation
markdown-preview.nvim copied to clipboard

open linked files

Open rjshrjndrn opened this issue 5 years ago • 17 comments

Hi, 1st of all thank you for this awesome plugin. I have a small question. Is it possible to open a linked file from one markdown? eg

this is [doc](doc.md)

and :MarkDownPreview but I am not able to click and open the file.

Regards, Rajesh

rjshrjndrn avatar May 17 '19 04:05 rjshrjndrn

还有还有,能不能一口气把一个directory下面的所有Markdown file一并_preview_一下?这个在捣鼓documentation的时候尤其有帮助

llinfeng avatar Aug 25 '19 19:08 llinfeng

Can you please translate in English.

rjshrjndrn avatar Aug 26 '19 03:08 rjshrjndrn

@rjshrjndrn I was simply extending on your original request. I also found that the links pointing to other *.md documents are broken in the Previews. Additionally, I was wondering if there is an option to preview an entire directory, wherein all the *.md files are made available in the Preview window/server.

Currently, from a valid Preview page with URL http://127.0.0.1:9054/page/2, if I were to click on a link [Eagle](Eagle.md), I will get forwarded to a new URL http://127.0.0.1:9054/page/Eagle ==> should all *.md files be available for the previews, I bet there is a high chance that these linked files can be rendered properly.

llinfeng avatar Aug 26 '19 15:08 llinfeng

It's also have a problem when you link to a another markdown file under folder.

this link [another](docs/another.md)

Preview will return 404 when you click on that link.

be99inner avatar Jan 07 '20 08:01 be99inner

This will also help vimwiki index.md previews i guess. Looking forwarrd for it.

eorus avatar Apr 06 '20 15:04 eorus

@eorus @be99inner One possible solution is to use other tools to host Markdown files for preview. I use markserv to host all files in my Vimwiki directory, and use :MarkdownPreview for one-off situations.

  • markserv is fired from the root folder where all my Vimwiki files lives. Thus, it is aware of all the files as linked through Markdown syntax. For example, [Another Page](another_page.md) shall link to the another_page.md properly. Reference to sections is a bit more complicated but doable;
  • The MarkdownPreview command in this repo is better at syncing the cursor location from Vim to the rendered webpage.

llinfeng avatar Apr 06 '20 16:04 llinfeng

Thanks @llinfeng for introducing markserv. Had a chance to look and decided to run it on I3 startup and use localhost:8642/index.md.

eorus avatar Apr 06 '20 18:04 eorus

Is there any update on this becoming a feature of MarkdownPreview? It would be really useful, and I would imagine that changing the url from something like ../page/1 to ../[filename] isn't that difficult.

ncharchut avatar Sep 02 '20 17:09 ncharchut

Seems this issue has been raised for a while and I am wondering whether there has been any update.

I have the same issue with link to files but not pictures or urls, i.e.

![dog pic](./dog.jpg) works
[link to website](https://www.google.com) works

[link to file](./file.md) does not work
[link to file2](./_resources/file2.pdf) does not work

These same codes work in other editors such as Atom or Joplin. Could there be a security issue that prevents the opening of linked local files? Can it be disabled?

whytong avatar Dec 09 '20 17:12 whytong

@iamcco Hi, Is there any update on this?

Thanks for your awesome job.

cstsunfu avatar Mar 30 '21 08:03 cstsunfu

I was looking for an open issue similar to this, I apologize if I overlooked anything.

But, what about handling wiki links? A lot of my notes started off in Obsidian.md and I've been playing around with VimWiki markdown recently.

Wikilink: 
Research in [[Computer Science]]
Equivalent to: 
Research in [Computer Science](./Computer Science.md)

When creating a link like this in either application a new file of the same name is created so I'm not sure what would be best for handling filenames that include spaces, or if it could be translated in the browser to something like: http://127.0.0.1:9054/page/computer_science http://127.0.0.1:9054/page/computer%20science

daephx avatar Sep 29 '21 08:09 daephx

Any updates on this?

Btw, thank you for this amazing plugin ❤️

domas-v avatar Sep 07 '22 18:09 domas-v

I implemented something like this in #543. Clicking a linked markdown file will open it in Vim and then refresh the browser to show that file's preview.

Since there are quite a few pull requests that didn't get merged or any feedback, this one will probably be the same. In case you want to use it anyways and need help with the compilation or manual setup, let me know and I'll try to help! :)

jannis-baum avatar Jan 16 '23 09:01 jannis-baum