您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Checks PRE and CODE tags in Summernote and ensures that their contents use HTML entities for proper display.
当前为
This script checks PRE and CODE tags in the Summernote editor when it loads and ensures that any tags they contain use HTML entities for proper display, mainly by replacing < and > characters. The clearest way to explain why this is useful is probably to explain why showing HTML tags in Kanka entries is difficult in the first place:
<pre><p>text</p></pre>
results in the paragraph being rendered outside the PRE block instead of shown inside it as markup; and if you try to show just an opening tag like <code><span></code>
, it gets replaced with <code><span></span></code>
because the validator wants all tags to be closed, which doesn’t display anything on the rendered page).<
for <
and >
for >
, e.g. <code><span></code>
. When the page is rendered, these are resolved to their respective characters, so you get what you want. But...Hence, this script solves part 3 of the issue by undoing Summernote’s conversion of HTML entities inside PRE and CODE tags specifically. It does not validate HTML before saving, so you are still responsible for using HTML entities in the first place. Various HTML entity converters on the Web can help make that step easier.