Implementation:0xranx OpenContext Markdown Rules
| Knowledge Sources | |
|---|---|
| Domains | Editor, Markdown_Serialization |
| Last Updated | 2026-10-24 00:00 GMT |
Overview
⚠ DEPRECATED: Plate markdown serialization and deserialization rules plugin, converting between Slate node trees and markdown strings. Only used by the dead PlateMarkdown component. See Heuristic:0xranx_OpenContext_Warning_Deprecated_Plate_Editor.
Description
The markdownRules.js module in src/ui/src/editor/plugins/ exports a createMarkdownPlugin factory that creates a Plate plugin for markdown serialization/deserialization. It defines rules for converting Slate nodes (headings, paragraphs, lists, code blocks, tables, links, blockquotes, etc.) to markdown and back, handling the full Plate node type system including list-classic variants.
Usage
Import and register this plugin in PlateMarkdown.jsx to enable markdown import/export.
Code Reference
Source Location
- Repository: 0xranx_OpenContext
- File: src/ui/src/editor/plugins/markdownRules.js
- Lines: 1-416
Signature
export function createMarkdownPlugin() // → Plate plugin config
// Also exports serializeMarkdown and deserializeMarkdown functions
Import
import { createMarkdownPlugin } from './editor/plugins/markdownRules';
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| editor | PlateEditor | Yes (serialize) | Editor for context |
| fragment | Node[] | Yes (serialize) | Slate nodes to convert |
| markdown | string | Yes (deserialize) | Markdown text to parse |
Outputs
| Name | Type | Description |
|---|---|---|
| serializeMarkdown | string | Markdown string from nodes |
| deserializeMarkdown | Node[] | Slate nodes from markdown |
Usage Examples
Creating and Using the Plugin
import { createMarkdownPlugin } from './editor/plugins/markdownRules';
const markdownPlugin = createMarkdownPlugin();
// Register with Plate
const editor = createPlateEditor({
plugins: [markdownPlugin, ...otherPlugins]
});
// Serialize selection to markdown
const md = serializeMarkdown(editor, fragment);
// Deserialize pasted markdown to nodes
const nodes = deserializeMarkdown(editor, pastedText);