Clickable wiki links in the nvALT preview

I worked this very short script up last night to help a friend scratch an itch. It allows the HTML preview window in nvALT to show [[wiki links]] as clickable text that will jump to linked notes in the editor.

You need to stick this script in the custom template for nvALT. This is located at ~/Library/Application Support/nvALT/template.html. Well, it’s supposed to be. If you’re one of the many for whom nvALT failed to create the templates when you first ran it, you can download a clean one, or try out something like Lopash. The clean one already has this script embedded and ready to go (it just lacks any other features).

If you’re editing your own or using Lopash, here’s the script that should be added right before the </body> tag:

Save the template to the above location and open nvALT with the preview window showing (Control-Command-P). Add a [[wiki link]] (press Command-Shift-L and start typing the name of a note) and you should immediately see the text become highlighted in the preview. Clicking it will open the related note.

Hopefully that’s helpful for some. I may build this into the default template, but I doubt I’ll ever make it native functionality. This should work just fine for most intents and purposes. Let me know if you have any trouble.