Table of content
– Development, 3 mins read
Wikilinks
Double bracketed links are converted to Jekyll-ingestible Markdown formatting by the bidirectional_links_generator.rb
plugin. However, Obsidian’s Wikilink setting also applies to a proprietary image embed format with double brackets.
I’m working on another plugin to complement the bidirectional link generator and resolve Obsidian image embeds automatically. This page is for testing the efficacy of the script and the regex I’m using.
This is a useful reference for Regex in Ruby and this is a good Ruby Regex Tester.
Version 1
- Does not support
"title"
in Markdown links because I couldn’t figure out the regex- Example:

- If you use these, the image will break
- Example:
- Fixed the problem with links rendering inside
[[code blocks]]
But it doesn't work in this [[type of block]] because of the extra linebreaks and characters before the tick marks
Is this also a code block oh shit
Version 2
I DID A GOOD REGEX!
- Code blocks can contain
[[brackets]]
without rendering links! - Markdown images contain
title
now!-
Update: Regex is faulty. When title exists, the asset path picks up the space before the
"
. Will fix later.
-
Update: Regex is faulty. When title exists, the asset path picks up the space before the
Edits:
- New plugin called
obsidian_images_generator.rb
with higher priority than the bidirectional links generator - Edited bidirectional links generator to exclude codeblocks
For those of you who would like to know, this is the regex I added to the end of each section in the generator:
(?!.*?[\r\n]+[`{3,}|~{3,}])
Helpful References
- https://github.com/github/cmark-gfm/blob/master/src/scanners.re
- https://github.com/jeffreytse/jekyll-spaceship/blob/master/lib/jekyll-spaceship/processors/element-processor.rb
- https://jekyllrb.com/docs/plugins/generators/
- https://stackoverflow.com/questions/45279912/select-all-code-in-md-codeblock
It works! Now you can drag and drop images to Obsidian editor and the asset path will automatically generate. Make sure to follow guidelines in [[ Obsidian Setup ]]
Testing
This image is in a Markdown link to nowhere and also has a title
Using the note title
variable: a note about cats. Using the note’s filename:
[[
cats
]]. Using the note’s title, with a label:
[[
cats|link to the note about cats using the note title
]]. Using the note’s filename, with a label:
[[
cats|link to the note about cats using the note’s filename
]]. In all cases, if the double-bracket link does not point to a valid note, the double brackets will still be shown, like this:
[[
there is no note that matches this link
]]. This is an Obsidian Image. . This is a Markdown image with alt text only.
. This is a Markdown image without alt text but with a title.
. This is an Obsidian image that links to the assets folder.
. And another with a slash.