🚸 Rewrite the markdown deserializer to improve br… (#1198)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Refactor** - Updated markdown handling and serialization libraries for improved performance and accuracy in text formatting. - **New Features** - Enhanced rich text and markdown conversion capabilities, providing users with more reliable and seamless text formatting options. - **Documentation** - Added detailed documentation for markdown to rich text conversion and vice versa, ensuring easier understanding and implementation for developers. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
12
packages/lib/markdown/remark-slate/remarkDefaultTextRules.ts
Normal file
12
packages/lib/markdown/remark-slate/remarkDefaultTextRules.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { MARK_BOLD, MARK_CODE, MARK_ITALIC } from '@udecode/plate-basic-marks'
|
||||
import { getPluginType, Value } from '@udecode/plate-common'
|
||||
|
||||
import { RemarkTextRules } from './types'
|
||||
|
||||
export const remarkDefaultTextRules: RemarkTextRules<Value> = {
|
||||
text: {},
|
||||
emphasis: { mark: ({ editor }) => getPluginType(editor, MARK_ITALIC) },
|
||||
strong: { mark: ({ editor }) => getPluginType(editor, MARK_BOLD) },
|
||||
inlineCode: { mark: ({ editor }) => getPluginType(editor, MARK_CODE) },
|
||||
html: { transform: (text: string) => text.replaceAll('<br>', '\n') },
|
||||
}
|
||||
Reference in New Issue
Block a user