Commit 993c7b9b889ec9c3526eafa6b5a14202802e7316

Martin Mitas 2019-11-03T23:32:46

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.

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