Tyler James Young
Tyler James Young

Reputation: 130

How do I stop CKEditor from inserting close tags after empty (self-close) MathML tags?

Proper MathML notation of repeating decimals calls for an empty <mline /> tag:

<math><mover align="right"><mn>0.16</mn><mline spacing="6" /></mover></math>

CKEditor doesn't recognize this as a proper empty tag and unhelpfully inserts a closing tag </mline> and messes up MathJax interpretation:

<math><mover align="right"><mn>0.16</mn><mline spacing="3"></mline></mover></math>

This has implications for use of MathML's other empty tags, like <maligngroup/> and <malignmark/>.

Upvotes: 0

Views: 74

Answers (1)

Tyler James Young
Tyler James Young

Reputation: 130

Solution was to add mline to CKEditors list of $empty tags in ckeditor_config.js:

CKEDITOR.dtd.$empty['mline'] = 1;

Ended up adding a few more just in case:

_(['mline', 'mspace', 'maligngroup', 'malignmark', 'msline']).each(function(tag, index){
  CKEDITOR.dtd.$empty[tag] = 1;
})

Upvotes: 1

Related Questions