Render LaTeX math into HTML as a tag <x-equation>... ... instead of <equation>. This is to highlight that it is not a standard HTML tag.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
diff --git a/md2html/render_html.c b/md2html/render_html.c
index 2442697..7f7e780 100644
--- a/md2html/render_html.c
+++ b/md2html/render_html.c
@@ -432,8 +432,8 @@ enter_span_callback(MD_SPANTYPE type, void* detail, void* userdata)
case MD_SPAN_IMG: render_open_img_span(r, (MD_SPAN_IMG_DETAIL*) detail); break;
case MD_SPAN_CODE: RENDER_LITERAL(r, "<code>"); break;
case MD_SPAN_DEL: RENDER_LITERAL(r, "<del>"); break;
- case MD_SPAN_LATEXMATH: RENDER_LITERAL(r, "<equation>"); break;
- case MD_SPAN_LATEXMATH_DISPLAY: RENDER_LITERAL(r, "<equation type=\"display\">"); break;
+ case MD_SPAN_LATEXMATH: RENDER_LITERAL(r, "<x-equation>"); break;
+ case MD_SPAN_LATEXMATH_DISPLAY: RENDER_LITERAL(r, "<x-equation type=\"display\">"); break;
}
return 0;
@@ -460,7 +460,7 @@ leave_span_callback(MD_SPANTYPE type, void* detail, void* userdata)
case MD_SPAN_CODE: RENDER_LITERAL(r, "</code>"); break;
case MD_SPAN_DEL: RENDER_LITERAL(r, "</del>"); break;
case MD_SPAN_LATEXMATH: /*fall through*/
- case MD_SPAN_LATEXMATH_DISPLAY: RENDER_LITERAL(r, "</equation>"); break;
+ case MD_SPAN_LATEXMATH_DISPLAY: RENDER_LITERAL(r, "</x-equation>"); break;
}
return 0;
diff --git a/test/latex-math.txt b/test/latex-math.txt
index 5547c8f..2a5774c 100644
--- a/test/latex-math.txt
+++ b/test/latex-math.txt
@@ -10,7 +10,7 @@ A math span is is any text wrapped in dollars or double dollars (`$...$` or
```````````````````````````````` example
$a+b=c$ Hello, world!
.
-<p><equation>a+b=c</equation> Hello, world!</p>
+<p><x-equation>a+b=c</x-equation> Hello, world!</p>
````````````````````````````````
If the double dollar sign is used, the math span is a display math span.
@@ -18,7 +18,7 @@ If the double dollar sign is used, the math span is a display math span.
```````````````````````````````` example
This is a display equation: $$\int_a^b x dx$$.
.
-<p>This is a display equation: <equation type="display">\int_a^b x dx</equation>.</p>
+<p>This is a display equation: <x-equation type="display">\int_a^b x dx</x-equation>.</p>
````````````````````````````````
Math spans may span multiple lines as they are normal spans:
@@ -29,7 +29,7 @@ $$
f(x) dx
$$
.
-<p><equation type="display">\int_a^b f(x) dx </equation></p>
+<p><x-equation type="display">\int_a^b f(x) dx </x-equation></p>
````````````````````````````````
Note though that many (simple) renderers may output the math spans just as a