如何获得 HTML 输出而不是 Markdown?

问题描述 投票:0回答:1

我目前正在使用 CKEditor 5 在我的应用程序中拥有一个文本编辑器(用 nextjs 制作)。问题是,我希望我的编辑器输出是 HTML,而不是 markdown。

当前编辑器代码

<CKEditor
  // @ts-ignore
  editor={CKEditorCustomBuild}
  onChange={(event: any, editor: any) => {
    const data = editor.getData();
    onChange(data);
  }}
/>

data
函数内部
onChange
的输出类似于:

Hello there, my _name_ is **John Doe**.

我想要以下格式:

Hello there, my <u>name</u> is <strong>John Doe</strong>.

我怎样才能实现这一目标?

javascript typescript ckeditor ckeditor5
1个回答
0
投票

与@endbermudas 的评论中的每个讨论:

CKEditor 5 默认以 HTML 格式输出内容。如果您将 Markdown 作为输出,则您可能正在使用 Markdown 插件或配置为输出 Markdown 的自定义构建。

© www.soinside.com 2019 - 2024. All rights reserved.