# Pandoc style superscript and subscript

**URL:** <https://forum.obsidian.md/t/pandoc-style-superscript-and-subscript/62369>\
**Category:** Feature requests\
**Created:** [June 29, 2023, 6:12pm UTC](https://forum.obsidian.md/t/pandoc-style-superscript-and-subscript/62369 "2023-06-29T18:12:14Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![shxie](https://forum.obsidian.md/user_avatar/forum.obsidian.md/shxie/32/788_2.png) [@shxie](https://forum.obsidian.md/u/shxie)\
**Post date:** [June 29, 2023, 6:12pm UTC](https://forum.obsidian.md/t/pandoc-style-superscript-and-subscript/62369/1 "2023-06-29T18:12:15Z")

</div>

### Use case or problem

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.

### Related feature requests (optional)

[Question about superscripts and subscripts](https://forum.obsidian.md/t/question-about-superscripts-and-subscripts/25941)

---

<div class="post-metadata">

**Author:** ![parkerrobb](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/p/bcef8e/32.png) [@parkerrobb](https://forum.obsidian.md/u/parkerrobb)\
**Post date:** [January 17, 2024, 2:09am UTC](https://forum.obsidian.md/t/pandoc-style-superscript-and-subscript/62369/2 "2024-01-17T02:09:55Z")

</div>

Second!

---

<div class="post-metadata">

**Author:** ![SidMan](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/s/f0a364/32.png) [@SidMan](https://forum.obsidian.md/u/SidMan)\
**Post date:** [July 2, 2024, 4:21pm UTC](https://forum.obsidian.md/t/pandoc-style-superscript-and-subscript/62369/3 "2024-07-02T16:21:56Z")

</div>

Joplin does this and it works well there.

---

<div class="post-metadata">

**Author:** ![matterhorn103](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/m/d2c977/32.png) [@matterhorn103](https://forum.obsidian.md/u/matterhorn103)\
**Post date:** [July 9, 2024, 12:01am UTC](https://forum.obsidian.md/t/pandoc-style-superscript-and-subscript/62369/4 "2024-07-09T00:01:32Z")

</div>

I would also love this! The same syntax seems to be used across [several flavours of Markdown](https://gist.github.com/vimtaai/99f8c89e7d3d02a362117284684baa0f).

---

<div class="post-metadata">

**Author:** ![a0405u](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/a/ebca7d/32.png) [@a0405u](https://forum.obsidian.md/u/a0405u)\
**Post date:** [August 11, 2024, 9:04pm UTC](https://forum.obsidian.md/t/pandoc-style-superscript-and-subscript/62369/5 "2024-08-11T21:04:12Z")

</div>

Something like ^^…^^ would be perfect!

---

<div class="post-metadata">

**Author:** ![StoneFace](https://forum.obsidian.md/user_avatar/forum.obsidian.md/stoneface/32/69485_2.png) [@StoneFace](https://forum.obsidian.md/u/StoneFace)\
**Post date:** [August 12, 2024, 1:19am UTC](https://forum.obsidian.md/t/pandoc-style-superscript-and-subscript/62369/6 "2024-08-12T01:19:32Z")

</div>

I would also use markdown superscripts.

---

<div class="post-metadata">

**Author:** ![fcskit](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/f/4da419/32.png) [@fcskit](https://forum.obsidian.md/u/fcskit)\
**Post date:** [November 13, 2024, 11:47am UTC](https://forum.obsidian.md/t/pandoc-style-superscript-and-subscript/62369/7 "2024-11-13T11:47:04Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![bobtheguitar](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/b/50afbb/32.png) [@bobtheguitar](https://forum.obsidian.md/u/bobtheguitar)\
**Post date:** [February 2, 2025, 11:13am UTC](https://forum.obsidian.md/t/pandoc-style-superscript-and-subscript/62369/8 "2025-02-02T11:13:47Z")

</div>

Recently started using Obsidian. Very keen to see this implemented!

---

<div class="post-metadata">

**Author:** ![fcskit](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/f/4da419/32.png) [@fcskit](https://forum.obsidian.md/u/fcskit)\
**Post date:** [February 18, 2025, 9:13am UTC](https://forum.obsidian.md/t/pandoc-style-superscript-and-subscript/62369/9 "2025-02-18T09:13:06Z")

</div>

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:

```lua
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 }
}

```

---

<div class="post-metadata">

**Author:** ![kotaindah55](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/k/ed655f/32.png) [@kotaindah55](https://forum.obsidian.md/u/kotaindah55)\
**Post date:** [February 18, 2025, 3:39pm UTC](https://forum.obsidian.md/t/pandoc-style-superscript-and-subscript/62369/10 "2025-02-18T15:39:18Z")

</div>

For the moment, you can use this plugin [Extended Markdown Syntax](https://github.com/kotaindah55/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.

---

<div class="post-metadata">

**Author:** ![kotaindah55](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/k/ed655f/32.png) [@kotaindah55](https://forum.obsidian.md/u/kotaindah55)\
**Post date:** [February 18, 2025, 4:35pm UTC](https://forum.obsidian.md/t/pandoc-style-superscript-and-subscript/62369/11 "2025-02-18T16:35:15Z")

</div>

But, surely, I’ll be really excited when Obsidian implement that syntax natively.

---

<div class="post-metadata">

**Author:** ![fcskit](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/f/4da419/32.png) [@fcskit](https://forum.obsidian.md/u/fcskit)\
**Post date:** [February 19, 2025, 10:34am UTC](https://forum.obsidian.md/t/pandoc-style-superscript-and-subscript/62369/12 "2025-02-19T10:34:43Z")

</div>

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:

```auto
[image caption](image.png){#fig:label1 width="6in" height="7.5in"}

```

Wich can then be referenced as @fig:label in the text.

---

<div class="post-metadata">

**Author:** ![CapinWinky](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/c/50afbb/32.png) [@CapinWinky](https://forum.obsidian.md/u/CapinWinky)\
**Post date:** [February 28, 2025, 3:26pm UTC](https://forum.obsidian.md/t/pandoc-style-superscript-and-subscript/62369/13 "2025-02-28T15:26:16Z")

</div>

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:

- `text^superscript _space_ not-superscript`
- `text^superscript^not-superscript`
- `text^(superscript)not-superscript`

---

<div class="post-metadata">

**Author:** ![WilltChambering](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/w/9dc877/32.png) [@WilltChambering](https://forum.obsidian.md/u/WilltChambering)\
**Post date:** [July 28, 2025, 2:40pm UTC](https://forum.obsidian.md/t/pandoc-style-superscript-and-subscript/62369/14 "2025-07-28T14:40:36Z")

</div>

Sure, but, Joplin will allow iOS code to break and remain broken to the point of forced abandonment.

So, no thanks.
