I inserted latex code into blogger Theme, immediately after saving it was automatically encoded. As a result, the math formula was broken when displayed. Original code:
<b:if cond='data:blog.pageType == "item"'>
<script type="text/javascript">
//<![CDATA[
window.MathJax = {
tex: {
inlineMath: [['$', '$'], ['\\(', '\\)']],
displayMath: [['$$', '$$'], ['\\[', '\\]']],
packages: ['base', 'ams', 'mhchem']
},
options: {
renderActions: {
addMenu: []
}
}
};
//]]>
</script>
<script async='async' src='https://polyfill.io/v3/polyfill.min.js?features=es6'></script>
<script async='async' id='MathJax-script' src='https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js'></script>
</b:if>
The code is encrypted after clicking Save
<script>
window.MathJax = {
tex: {
inlineMath: [['$', '$'], ['\(', '\)']],
displayMath: [['$$', '$$'], ['\\[', '\\]']],
packages: ['base', 'ams', 'mhchem']
},
options: {
renderActions: {
addMenu: []
}
}
};
</script>
<script async='async' src='https://polyfill.io/v3/polyfill.min.js?features=es6'/>
<script async='async' id='MathJax-script' src='https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js'/>
I need everyone's help.
Maybe it was some kind of temporary issue? When you use CDATA:
<script type='text/javascript'>
//<![CDATA[
your code here
//]]>
</script>
Blogger should not change characters after saving your theme (floppy disk icon). I just confirmed this on my test blog and it works as it should in the theme editor, the HTML gadget added via the Layout tab and in the post editor (without <b:if> for the latter two as conditional tags only work directly in the theme).