obsidian-enhancing-export icon indicating copy to clipboard operation
obsidian-enhancing-export copied to clipboard

Explicit support for Callouts in the Markdown(Hugo) dialect

Open ShaddyDC opened this issue 1 year ago • 5 comments

Obsidian has support for a Markdown Extension called Callouts.

They effectively allow you to have special sections in your files to for example give a useful tip:

> [!tip] Callouts can have custom titles
> Like this one.

Currently, without special treatment, they are exported verbatim. Unfortunately, afaict, Hugo does not support this syntax. Maybe there is an elegant way to implement it, but I have not seen it.

Instead, I would suggest converting it to a shortcode, similar to what is already being done with mathjax. Then a user can define it to work however they want. It would have as parameters the title and the kind of callout, maybe an extra flag about whether it's collapsible, and the rest as the content. I'm not sure if that would work for nested callouts, but I'm not sure how common those are anyway.

Any thoughts or alternative suggestions? Maybe there's a better way I overlooked.

ShaddyDC avatar May 01 '23 21:05 ShaddyDC

I'm interested in this as well. Just installed the OEE plugin hoping it would work, but even the HTML is lacking the necessary CSS.

cgranier avatar May 12 '23 19:05 cgranier

Currently there is no energy to support Obsidian's unique markdown syntax. If you're interested in this, try pandoc's lua-filter. Finally done, welcome to provide your lua scripts and command templates to this plugin. that would benefit more users of this plugin.

mokeyish avatar May 12 '23 21:05 mokeyish

I will take a look. I spent most of the afternoon trying to decipher Obsidian's CSS code for callouts, in order to recreate them in Hugo as a shortcode. I've advanced, but can't say I'm anywhere near a solution.

cgranier avatar May 12 '23 22:05 cgranier

Here is the example snipets that produce ouput for Hugo: https://github.com/mokeyish/obsidian-enhancing-export/blob/144a8d7d4f0ce4beb4d9caaa3c549a780f6a2aab/lua/markdown.lua#L141-L151

mokeyish avatar May 12 '23 22:05 mokeyish

Tip for those who stumble upon this issue: you can use this lua filter: https://gist.github.com/jskherman/8e721302e67d308e8a81f3df84f01f20

aviskase avatar Mar 13 '24 13:03 aviskase