Skip to content
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

Subscript and Superscript implementation #388

Open
Dagur opened this issue Jun 25, 2020 · 0 comments
Open

Subscript and Superscript implementation #388

Dagur opened this issue Jun 25, 2020 · 0 comments

Comments

@Dagur
Copy link

Dagur commented Jun 25, 2020

I'm wondering why subscript and superscript are implemented differently than for example bold and italic in rules.js

What I mean is that bold has strong_open and strong_close like this

rules.strong_open = function(/* tokens, idx, options, env */) {
  return '<strong>';
};
rules.strong_close = function(/* tokens, idx, options, env */) {
  return '</strong>';
};

but super/subscript is like this

rules.sub = function(tokens, idx /*, options, env */) {
  return '<sub>' + escapeHtml(tokens[idx].content) + '</sub>';
};

so the whole thing, including content, is one token.

This means that text inside sub and sup that has other formatting is not dealt with. Wouldn't it be better if it was treated the same way as bold and italic?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant