-
-
Notifications
You must be signed in to change notification settings - Fork 224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for subscript and superscript #224
Comments
It is not as easy as it may sound. Unicode is a huge mess. And even assuming a particular use case only requires available characters such as digits, we can't assume every output terminal is able to display them. Depending on the use case, some people might resort to notation such as So there is no one-fits-all solution. And I don't want to include very limited solutions in the base package. I'm considering to make a cookbook in the repo wiki to list custom formatter examples for common cases like this, so people can copy and customize them. The idea is on the back of my mind, but for now I'm focused on higher priority things. Some recipes are just not possible yet. Also, I think I'm not done yet with breaking changes, so I don't want to keep updating the cookbook too... One variant of custom formatter for sub/sup might be the following: {
formatters: {
'supFormatter': function (elem, walk, builder, formatOptions) {
builder.pushWordTransform(str => sup(str));
walk(elem.children, builder);
builder.popWordTransform();
}
},
tags: {
'sup': { format: 'supFormatter' }
}
} where the |
Thanks for the explanation! |
I need to use superscript and subscript like this
This text contains subscript text.
This text contains superscript text.
The text was updated successfully, but these errors were encountered: