mokeyish / obsidian-enhancing-export

This is an enhancing export plugin base on Pandoc for Obsidian (https://obsidian.md/ ). It's allow you to export to formats like Markdown、Markdown (Hugo https://gohugo.io/ )、Html、docx、Latex etc.
MIT License
344 stars 23 forks source link

Explicit support for Callouts in the Markdown(Hugo) dialect #60

Open ShaddyDC opened 1 year ago

ShaddyDC commented 1 year ago

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.

cgranier commented 1 year ago

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.

mokeyish commented 1 year ago

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.

cgranier commented 1 year ago

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.

mokeyish commented 1 year ago

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

aviskase commented 8 months ago

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