ant-design / pro-editor

🕹️ The Ultimate Editor UI Framework and Components
https://pro-editor.antdigital.dev
MIT License
199 stars 25 forks source link

Markdown html代码块中的html代码被解析了 #131

Closed jiabochao closed 8 months ago

jiabochao commented 8 months ago

这段markdown内容中,有一段```html代码块内容,html代码块被解析渲染了


```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Styled List</title>
<style>
    /* 添加边距和去除默认样式 */
    ul {
        margin: 0;
        padding: 0;
        list-style-type: none; /* 移除默认的列表标记 */
    }

    /* 为列表项添加样式 */
    ul li {
        background-color: #f2f2f2; /* 设置背景色 */
        border: 1px solid #ddd; /* 设置边框 */
        padding: 8px 16px; /* 设置内边距 */
        margin-bottom: 4px; /* 设置元素间距 */
        font-family: Arial, sans-serif; /* 设置字体 */
    }

    /* 当鼠标悬停时改变背景色和边框色 */
    ul li:hover {
        background-color: #e9e9e9;
        border-color: #ccc;
        cursor: pointer; /* 鼠标悬停时显示手型指针 */
    }
</style>
</head>
<body>

<ul>
    <li>fdsfdsf</li>
    <li>fdsfdsf</li>
    <li>fdsfdsf</li>
</ul>

</body>
</html>

实际效果是这样

image

预期效果应该是不解析

ONLY-yours commented 8 months ago

开头的 "```html "应该不用加这个标志,直接用就行。我加了插件看起来可以了

jiabochao commented 8 months ago

确实,但是ChatGPT会这样输出html代码

ONLY-yours commented 8 months ago

确实,但是ChatGPT会这样输出html代码

试试 应该发版解决了

ONLY-yours commented 8 months ago

@jiabochao 我们发现两个插件在解析特殊格式的markdown 会有问题。在 pro-editor 这层我们改动变成了支持传入 Plugin 渲染的写法:https://github.com/ant-design/pro-editor/pull/134

jiabochao commented 8 months ago

@jiabochao 我们发现两个插件在解析特殊格式的markdown 会有问题。在 pro-editor 这层我们改动变成了支持传入 Plugin 渲染的写法:#134

收到,感谢更新!我研究一下。