Remove Obsidian wikilinks in Marked 2 (export to PDF/print)

I hope Obsidian devs will implement a native feature to easily format our markdown notes for exporting and printing purposes. Right now, I use Marked 2.

The goal here is to load a preprocessor in Marked 2 with a regex turning:

I love [[Bakery MOC#Donuts|big fat donuts]]!


I love big fat donuts!

Step 1: Follow this tutorial.

Step 2: We modify the script from the tutorial.

Instead of:

input.gsub!(/\[\[(.*?)\]\]/) do |m|
  match = Regexp.last_match
  link_target = match[1]

print input


input.gsub!(/\[\[[^\]\[]*\|(.*?)\]\]/, '\1')

print input

Thanks for this.

After following your instructions my text goes from:

I love [[Bakery MOC#Donuts|big fat donuts]]!


I love [[big fat donuts!]]

any thoughts?

This is somewhat related to this but if someone would like to have Obsidian [[WikiLinks]] with aliases visible and clickable within Marked app instead of have them removed i modified original preprocessor script to take care of just that. It will allow you to open such links directly in Obsidian.

Here it is with instructions. Maybe it will help someone.

Side note

Iā€™m using this along with Marked2 Custom Preprocessor option and pandoc for rendering my Obsidian notes for the output. Marked2 is very powerfull in that regard, allowing me to have References rendered from Zotero via autoupdated .bib file

full Args are (change your paths of course, and pick up style of your liking)

--citeproc -f markdown -M lang=pl-PL -t html5 --csl=/your/path/to/chicago.csl --bibliography=/your/path/to/Library.bib

With those in place sth like this below is possible. The note is in Polish so sorry for that but you can see references - in Chicago style - rendered at the bottom