Rosey/markdown-draft-js

Request : support superscript/subscript?

Closed this issue · 2 comments

Hi,

Thanks for the great work. I am planning to use in favour of npmjs.com/package/draft-js-utils.

I would like to know do you have any plans to support sub/sup tag?

Rosey commented

Thanks! Sorry for the very long delay in reply.

I haven't thought about this deeply but I wanted to quickly say SOMETHING.

Remarkable supports superscript and subscript (https://github.com/jonschlinkert/remarkable/blob/fa88dcac16832ab26f068c30f0c070c3fec0d9da/demo/example.md)

Which means you should be able to write your own code for this using the blockStyles option, like

(warning, untested code ahead, but I think this maps correctly)

markdownToDraft(markdownStringVariable, {blockStyles: { 'sup': 'SUP'})

and also ensure the draftEditor itself is properly set up to render superscript/subscript. https://draftjs.org/docs/advanced-topics-inline-styles/

Thank you, I will try and let you know how it goes!