Use Marked to open nvALT internal links

fildrake44's Avatar


20 Mar, 2018 04:53 PM

I am using Marked to preview nvALT markdown notes, and I am using nvALT's internal linking syntax like this:

  • [[my-file-foo]]
  • [[my-file-bar]]

These appear clickable in nvALT and take you to that note in nvALT. But in Marked, they render as plain text and not links. How can I make these links clickable in Marked 2? Ideally, clicking them should open the markdown file in either Marked 2 or even in nvALT.

For some context, I am managing a library of markdown files that link to each other, and we are trying to get Marked/GitHub/nvALT to play together nicely, with respect to showing either clickable regular markdown links or clickable internal nvALT links. Users often use nvALT to view and edit the markdown files. Since nvALT does not make regular markdown links clickable, we are trying to use nvALT internal links and make them clickable in Marked 2 / Github... which is also annoying. Unless there a scheme that makes regular markdown links clickable in nvALT (in the raw non-preview mode)?


  1. Support Staff 1 Posted by Brett on 20 Mar, 2018 08:31 PM

    Brett's Avatar

    nvALT's editor parses wiki links out, and the preview does it with JavaScript (unless you're using a custom template). The JS that makes it happen looks like this:

    var container = document.getElementById("wrapper");
                container.innerHTML = container.innerHTML.replace(/\[\[(.*?)\]\]/,"<a href='nvalt://find/$1'>$1</a>");

    A custom preprocessor that simply injected that into every preview would essentially add nvALT wiki support to Marked. However, it probably wouldn't help on GitHub. You'd need to write your own script that made the same regex conversion in the second line of the above script to the actual Markdown before pushing it to GitHub (though that could be added to a post-commit hook...).


  2. 2 Posted by David on 28 Mar, 2018 04:12 PM

    David's Avatar

    Any suggestion of how could this be implemented in Pandoc? I use it as a custom processor in Marked 2, and having functional wiki links would make my note-taking system just perfect.

  3. Support Staff 3 Posted by Brett on 28 Mar, 2018 07:20 PM

    Brett's Avatar


    Add a preprocessor that does a simple search and replace. In Ruby for example:


Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:


Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac