pressbooks / pb-mathjax

A replacement for wp.com/latex.php but instead of LaTeX, it uses MathJax.
GNU General Public License v3.0
4 stars 1 forks source link

MathML stripped out upon HTML import #17

Closed SteelWagstaff closed 5 years ago

SteelWagstaff commented 5 years ago

When a html file containing MathML is imported to Pressbooks using the html import routine, the MathML is stripped out or sanitized so that it no longer displays as expected. Users must instead copy/paste the html source into the text editor. Ideally, MathML would be able to pass through the import and ingestion routine unchanged.

SteelWagstaff commented 5 years ago

As an example, see this chapter of a Saylor book: https://saylordotorg.github.io/text_introductory-statistics/s06-01-three-popular-data-displays.html. It can be imported to PB using the HTML import routine, but the product looks like: https://university.pressbooks.pub/import/chapter/three-popular-data-displays/. Images are included, but MathML is not. If the user copy/pastes the source into Pressbooks, MathML works, but images (which have relative links) do not. See: https://integrations.pressbooks.network/testbookfun/chapter/three-popular-data-displays/

dac514 commented 5 years ago

This is fixed with the slogan "Not all imports are sanitized equal."

The rules in Step 2 are based on WordPress role. The principle is the same as why superadmin can paste whatever HTML they want in TinyMCE, but an editor cannot.

Using the example URL, super admin will import:

<math xml:id="fwk-shafer-ch02-m0001" display="block">... snip ...

An editor:

<math display="block">... snip ...

Synonym of technically, assuming our custom MathML + kses rules are on purpose, there's no difference.

mcgratay commented 5 years ago

Resolved.