Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]代码块里的html标签无法正常渲染 #587

Open
web-mobli opened this issue Aug 8, 2023 · 0 comments
Open

[BUG]代码块里的html标签无法正常渲染 #587

web-mobli opened this issue Aug 8, 2023 · 0 comments
Assignees

Comments

@web-mobli
Copy link

web-mobli commented Aug 8, 2023

BUG描述 | Describe the bug

  • 代码块里有html代码时,发布文章后代码块的标签会被删掉,并且高亮会消失

复现方法 | To Reproduce

代码块里面输入html标签可以复现,见下方示例代码,js或者其他语言高亮就正常显示,并且也没问题

期望行为 | Expected behavior

  • 期望html语言代码块里正常展示标签,不会被吃掉,并且高亮显示

截图 | Screenshots

预览的时候标签就没了

image

发布后文章页的截图,标签全部没了,并且代码块高亮也没有展示

image

查看html源码,里面所有的标签都被去掉了

image

但js是正常,高亮也正常

image

测试代码如下

<h2>1. 这是代码块 1</h2>
<pre><code class="language-html"><body>
	<p>这是一个p标签</p>
	<button>按钮1个</button>
	
	<script>
	  let str = '这是一个字符串'
	  console.log(1111)
	</script>
</body>
</code></pre>
<h2>2. 这是代码块 2</h2>
<pre><code class="language-html"><p>Hello World</p>
<button>change</button>
<script>
  var h1 = document.querySelector("h1");
  var btn = document.querySelector("button");

  // 死循环指定的时间
  function delay(duration) {
    var start = Date.now();
    while (Date.now() - start < duration) {}
  }

  btn.onclick = function () {
    h1.textContent = "你好,世界!";
    delay(3000);
  };
</script>
</code></pre>
<h3>2.1. 这是代码块 3</h3>
<pre><code class="language-html"><p>Hello World</p>
<button>change</button>
<div>这是一个div</div>
</code></pre>
<h3>2.2. 这是 js 代码</h3>
<pre><code class="language-js">let str = 'hello word!'
concole.log(str)

function sum(a, b){
	return a + b
}

sum(1, 3)
</code></pre>

调试信息 | Debugging info

wp-editormd-debug-info

@web-mobli web-mobli changed the title [BUG] [BUG]代码块里的html标签无法正常渲染 Aug 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants