Obsidian currently can render superscript and subscript using HTML tag <sup> and <sub>, or mathjax $^{ }$ and $_{ }$. However, the HTML tag does not recognized by pandoc by default without a filter, and using mathjax for units like $m^2$ is fine but can be really painful for long sentences.
Proposed solution
Allow the render of the pandoc style super- and subscripts such as m^2^ and CO~2~
Current workaround (optional)
Current workaround is simply ignore the fact that ^^ and ~~ are not rendered in Obsidian, and send the markdown as it is to Pandoc.
I would also love to see native support for this syntax in obsidian. The <sub> and <sup> tags borrowed from HTML don’t feel very much like markdown and are much less convenient to type than ~~ or ^^. Since Obsidian is build on Markdown and conveniance, it is not clear to why the obsidian team has not implemented support for this, at least as an option. I think there are far more people using obsidian that regularly have to use sub- and superscripts than people frequently using ~ or ^ characters in their notes.
Second, based on other threads in the forum, I would assume that there are lots of users using pandoc to export notes to MS Word or similar file formates to share them with friends or colleagues. Probably everyone using pandoc would therefore very much welcome this too.
I recently created a lua filter for pandoc that replaces HTML style and formatted super and subscript by pandoc style ~~ and ^^
I would still love to see native support from obsidian for pandoc style super- and subscripts. Maybe I’ll try writing a plugin one day to support this via an extension.
Here is my lua filter for pandoc to support obsidian style super- and subscripts:
function Inlines(inlines)
local result = pandoc.List()
local i = 1
while i <= #inlines do
local el = inlines[i]
if el.t == "RawInline" and el.format == "html" then
if el.text == "<sub>" then
local content = pandoc.List()
i = i + 1
while i <= #inlines and not (inlines[i].t == "RawInline" and inlines[i].format == "html" and inlines[i].text == "</sub>") do
content:insert(inlines[i])
i = i + 1
end
result:insert(pandoc.Subscript(content))
elseif el.text == "<sup>" then
local content = pandoc.List()
i = i + 1
while i <= #inlines and not (inlines[i].t == "RawInline" and inlines[i].format == "html" and inlines[i].text == "</sup>") do
content:insert(inlines[i])
i = i + 1
end
result:insert(pandoc.Superscript(content))
else
result:insert(el)
end
else
result:insert(el)
end
i = i + 1
end
return result
end
return {
{ Inlines = Inlines }
}
For the moment, you can use this plugin Extended Markdown Syntax to support some syntax like Pandoc-style super- and subscript. But you have to install it manually or using BRAT, since the plugin hasn’t been released yet.
Thank’s for sharing the link to your plugin. Seems like it does exactly what I was searching for. If I had a wish for an additional formatting feature, it would be to support pandoc/crossref style markdown parameters for instance to set a label for an image or heading that for referencing in the text, since I use obsidian and pandoc to create reports or scientific manuscripts with numbered images.
So the pandoc/crossref syntax for a referenced image would be:
What I find curious is when I typed m^2, it was rendered as superscript already until I pressed space. It’s like they’re not just not supporting this fairly standard markdown, but actively disabling it.
Syntax for this typically supports the first of these three and one of the other two for non-space exiting: