GitbookIO / kramed

A markdown (kramdown compatible) parser and compiler. Built for speed. (Fork of marked)
MIT License
223 stars 47 forks source link

Inline scripts are not correctly processed #23

Closed SamyPesse closed 9 years ago

SamyPesse commented 9 years ago

For example:

**Proof:** If <script type="math/tex; ">g</script> is concave, then <script type="math/tex; ">g(x)\\leq g(\\mu)+(x-\\mu)\'\\eta(\\mu),</script>
where <script type="math/tex; ">\\eta(\\mu)</script> is an arbitrary element of the
subgradient of ..

is returned as:

<p><strong>Proof:</strong> If <script type="math/tex; ">g</script> is concave, then <script type="math/tex; ">g(x)\leq g(\mu)+(x-\mu)\&#39;\eta(\mu),</script>
where <script type="math/tex; ">\eta(\mu)</script> is an arbitrary element of the
subgradient of ..</p>

(' is escaped in the script).

<script type="math/tex; ">g(x)\leq g(\mu)+(x-\mu)\&#39;\eta(\mu),</script> tag is processed as 2 tags (https://github.com/GitbookIO/kramed/blob/master/lib/lex/inline.js#L108), and its content is escaped

SamyPesse commented 9 years ago

Same as https://github.com/GitbookIO/kramed/blob/master/lib/lex/block.js#L298 pre, script and styleshould not be escaped

AaronO commented 9 years ago

Does this look good ? :

<p><strong>Proof:</strong> If <script type="math/tex; ">g</script> is concave, then <script type="math/tex; ">g(x)\\leq g(\\mu)+(x-\\mu)\'\\eta(\\mu),</script>
where <script type="math/tex; ">\\eta(\\mu)</script> is an arbitrary element of the
subgradient of ..</p>