tui.editor
tui.editor copied to clipboard
Add superscript and subscript toolbar items
It would be very useful to have superscript and subscript toolbar items.
I haven't dug too deep into tui editor yet, but I looked in the Squire codebase and found superscript and subscript functions, exactly like how sq.bold()
is used in WYSIWYG Bold command.
Is this possible despite the fact that superscript and subscript is not directly supported with markdown? I've started my own implementation just adding custom toolbar items. I'd love to see it in the full application.
Thank you for your time.
@henrywalters Currently, inline html is allowed in the Markdown editor. If you use <sup>
and <sub>
tags, it will be added to the markdown editor. I'm not sure how you're trying to implement it, but I think you can add <sup></sup>
inline html where the cursor is now when you click the toolbar button.
a<sup>2</sup>+b<sup>2</sup>=c<sup>2</sup>
C<sub>8</sub>H<sub>10</sub>N<sub>4</sub>O<sub>2</sub>
a2+b2=c2
C8H10N4O2
Hey @seonim-ryu thanks for getting back to me. I'm happy to hear this is allowed in the editor! Your idea of implementing this is exactly what I was thinking. If I were to create a pull request for this, do you think it could be accepted?
@henrywalters Sorry for the late answer. First of all, it looks great that you are trying to develop!
We discussed this feature, but superscript and subscript are not CommonMark specifications, so if you want to develop, it's right to develop as a plugin.
The link below is a repository of a friend who made a plugin for the Editor a while ago, and you can refer to it and make it like this. And code review can be done by looking at the situation.
https://github.com/C-likethis123/tui-font-size-picker
https://github.com/nhn/tui.editor/issues/3178#issuecomment-1724169988