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

Math is not rendered in HTML #73

Open
alexpearce opened this issue May 5, 2017 · 0 comments
Open

Math is not rendered in HTML #73

alexpearce opened this issue May 5, 2017 · 0 comments

Comments

@alexpearce
Copy link

Given the contents of foo.md:

The expression $$x = y$$ is boring.

When I run this command:

$ markup-toHTML foo.md

I get this output:

<p>The expression  is boring.</p>

The math has been removed.

I expect to get this:

<p>The expression $$x = y$$ is boring.</p>

Or perhaps this:

<p>The expression <math>x = y</math> is boring.</p>

(Preferably the former — keeping $$ — so that I can then pass the output to something like KaTeX.)


I get the same behaviour when using the API:

const { State } = require("markup-it");
const markdown = require("markup-it/lib/markdown");
const html = require("markup-it/lib/html");

const text = "The expression $$x = y$$ is boring.";

const mdState = State.create(markdown);
const document = mdState.deserializeToDocument(text);
const htmlState = State.create(html);
// console prints "<p>The expression  is boring.</p>"
console.log(htmlState.serializeDocument(document));

I've tried following through the logic of the conversion, but I haven't found anything obvious. My only clue is that the math element is represented as a node with isVoid: true. It might be that void nodes aren't converted to HTML, but I haven't found the line that would drop such nodes.

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