emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CDATA auto aggregation


From: Tim Cross
Subject: Re: CDATA auto aggregation
Date: Sat, 27 Nov 2021 11:54:46 +1100
User-agent: mu4e 1.7.5; emacs 28.0.60

Diego Rodriguez <diego.vincent.rodriguez@gmail.com> writes:

> Hello,
>
> I am customizing my org-mode installation but there is something that I don't 
> understand.
>
> When I execute the following statement:
>
> ```
> (setq org-html-mathjax-template
>
> "
> <script type=\"text/x-mathjax-config\">
>     MathJax.Hub.Config({
>         displayAlign: \"%ALIGN\",
>         displayIndent: \"%INDENT\",
>         \"HTML-CSS\": { scale: %SCALE,
>                         linebreaks: { automatic: \"%LINEBREAKS\" },
>                         webFont: \"%FONT\"
>                        },
>         SVG: {scale: %SCALE,
>               linebreaks: { automatic: \"%LINEBREAKS\" },
>               font: \"%FONT\"},
>         NativeMML: {scale: %SCALE},
>         TeX: { equationNumbers: {autoNumber: \"%AUTONUMBER\"},
>                MultLineWidth: \"%MULTLINEWIDTH\",
>                TagSide: \"%TAGSIDE\",
>                TagIndent: \"%TAGINDENT\"
>         }
>     });
> </script>
> <script src=\"%PATH\"></script>
> ")
> ```
>
> A `CDATA` tag gets appended in my HTML export as shown below:
>
> ```html
>   <script type="text/x-mathjax-config">
> <![CDATA[
>     mathjax.hub.config({
>         displayalign: "center",
>         displayindent: "0em",
>         "html-css": { scale: 100,
>                         linebreaks: { automatic: "false" },
>                         webfont: "TeX"
>                        },
>         svg: {scale: 100,
>               linebreaks: { automatic: "false" },
>               font: "TeX"},
>         nativemml: {scale: 100},
>         tex: { equationnumbers: {autonumber: "AMS"},
>                multlinewidth: "85%",
>                tagside: "right",
>                tagindent: ".8em"
>         }
>     });
>   ]]>
>   </script>
>   <script src=
>   
> "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS_HTML";
>   type="text/javascript">
> </script>
> ```
>
> As you can see above, when I set the variable I have no CDATA tag on it. 
> Where does this tag come from? The problem is that the
> CDATA tag messes up with the MathJax configuration parser, as it expects a 
> JavaScript script inside. But, instead, it finds a CDATA tag
> that, while it might be valid according to W3, the MathJax parser throws an 
> `eval` error in the console since it tries to parse the body of
> that HTML node.
>
> Where does this CDATA tag gets added automatically and how can I modify this 
> behavior?
>

Unfortunately, I don't know precisely where that tag gets added from. I
suspect it could be related to the ox-html stuff, which is still based
on xhtml rather than html5. I did suggest some months back that it was
probably about time we updated to export as html5 rather than the now
deprecated xhtml, but there were a few who felt that this would result
in the loss of key functionality they wanted to maintain.

We probably should consider moving the existing ox-html to an ox-xhtml
and implementing a new ox-html that is based on html5. 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]