我有一个关于编程的网页,它有一些带有代码块的文章。现在,Google网站站长工具向我报告我的AMP实施存在一些问题。
我搜索了一下,我认为问题在于使用像这样的代码块:
<pre lang="c">
#include <stdlib.h>
#include <stdio.h>
#include <gmp.h>
...
</pre>
AMP工具会分析此代码并向我报告一些问题,例如:
标签&#34; stdio.h&#34;不允许
标签&#34; stdlib.h&#34;不允许
我已阅读AMP文档,但我找不到任何解决方案,所以您知道如何解决吗?
PD:将代码发布为图像并不是我的有效解决方案。
答案 0 :(得分:2)
你需要逃避&#39;&lt;&#39;和&#39;&gt;&#39;在你的源代码中
<pre lang="c">
#include <stdlib.h>
#include <stdio.h>
#include <gmp.h>
...
</pre>
答案 1 :(得分:0)
如果您使用的是PHP,则函数htmlentities会搜索所有特殊字符以避免出现问题。
所需的翻译是(&amp;,“,”,&lt;,&gt;)