remarkjs/remark-math

Use dashes for classes instead of camelCase

wooorm opened this issue · 4 comments

Subject of the feature

Classes in HTML/CSS are typically written as lowercase and with dashes: this-that, not thisThat.

Problem

This library uses camelcase.

Expected behaviour

  • Block math: <div class="math math-display>
  • Inline math: <span class="math math-inline> (optionally with math-display class for $$)

/cc @Rokt33r

If this is approved, I’d also want to suggest to drop the tag name check:

const inline = tagName === 'span' && classes.includes('inlineMath')
const displayMode =
(double &&
tagName === 'span' &&
classes.includes('inlineMathDouble')) ||
(tagName === 'div' && classes.includes('math'))

...And just check classes (that way HTML authors, so without remark-math, can use other tag names)

Both make sense to me. I guess this should be major changes! I'll try it in this week.

Oh you're already working on it! I'll keep tracking the changes then.

Perfect! I’d like to see if KaTeX will move to hast, and based on that cut a new major release!