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
328 stars 20 forks source link

Enabling raw_html in markdown-hugo export #101

Open SteveDockar opened 1 year ago

SteveDockar commented 1 year ago

I'm very new to this so apologies if there's a simple explanation I've missed in my searching.

The issue: I occasionally resort to native HTML in my directly written Hugo posts and, if it's the quickest way to a one-off fix, in Obsidian notes too. I'm currently trying to carry an aria-label in a <span> element across with an export, but without success.

Reading the pandoc plugin docs it seems there is a _rawhtml extension as well as _nativespan/div ones which might do what I need, but I can't figure out how to add them to the command line in the -f and/or -t parts (if that's even the right place) or if there's another place/way I should go about this.

Can anyone point me in the right direction please?

mokeyish commented 1 year ago

Please refer here https://pandoc.org/chunkedhtml-demo/7-extensions.html

and modify the export template or you can change it in your obsidian settings.

https://github.com/mokeyish/obsidian-enhancing-export/blob/e64211c4d4f9aad24c902c46dad5f5d63bc834e1/src/export_templates.ts#L28-L34

SteveDockar commented 1 year ago

Thanks, it looks like I was on the right track, I just couldn't/can't get it to work. I tried adding +raw_html to the -f markdown but Pandoc reports it's not supported, so I tried in on the "to" parameters instead. That didn't seem to make any difference. As an example, <span aria-label="Wide Area Network">WAN</span> is converted to [WAN]{aria-label="Wide Area Network"} in Hugo/Commonmark.

I was trying to switch from using <abbr> tags for expanding acronyms and Obsidian pops up that aria-label in the same way as the abbr tags do in Hugo. But, sadly, Hugo doesn't pop-up the aria-label text (hopefully it would screen-read it), so I'd still need to add the <abbr> tags. Because of that, I've just done some more testing, and it seems the abbreviation tags are passed through the standard Markdown-Hugo export as raw html correctly, but the span/aria html is converted in to that []{} layout whatever I try...

Thanks again for your help, but it seems I'm stuck even if I can get the export to correctly format my span, so it's currently not a loss I need to worry about.