Closed GoogleCodeExporter closed 9 years ago
What does your HTML look like?
<pre>#include <math.h></pre>
is a <pre> with the text "#include " followed by a malformed <math> tag
regardless of whether prettify is used.
If that was your problem, you can use entities thus
<pre>#include <math.h></pre>
or use an element whose content is unformatted text
<xmp>#include <math.h></xmp>
Original comment by mikesamuel@gmail.com
on 15 Apr 2013 at 11:12
[deleted comment]
Ignore my previous comment.
<xmp> solved it.
I was using the < > solution before but that is more complicated since you have
to find the tags and ignore them in comments etc.
Is there a reason this (<xmp>) is not done by default by prettify?
Original comment by oscarmo...@gmail.com
on 16 Apr 2013 at 8:39
xmp is deprecated apparently. I should have mentioned I'm using html5.
Original comment by oscarmo...@gmail.com
on 16 Apr 2013 at 8:52
Prettify takes code in HTML as input and makes it prettier. There's no real
way for prettify to find code that hasn't been escaped since the HTML parser
sees it first, and there's no single way to reverse the DOM that the HTML
parser will produce from plain text code like the python
HTML_DOUBLE_QUOTE_ENTITY = """
since prettify will only see a text node like
HTML_DOUBLE_QUOTE_ENTITY = """
which looks like the beginning of a multi-line string.
It is also a goal for prettify to preserve links and inline formatting elements
within code.
Since you're using HTML 5, I'm sure you're aware that <math> is a tag that
starts a foreign MathML sub-tree, so even doing a best effort with your
particular code would be problematic -- what if someone want's to embed
equations in code.
Original comment by mikesamuel@gmail.com
on 16 Apr 2013 at 6:21
Original issue reported on code.google.com by
oscarmo...@gmail.com
on 13 Apr 2013 at 9:25