Files
outline/shared/editor/nodes/Text.ts
T
Tom Moor ef1790e143 fix: Do not escape plain URL link text in Markdown output (#14707)
* fix: Do not escape plain URL link text in Markdown output

* fix: Escape pipes in plain URL links inside table cells

* fix: Escape table pipes in autolinks without a replace call
2026-11-25 19:21:12 -05:00

27 lines
680 B
TypeScript

import type { Node as ProsemirrorNode, NodeSpec } from "prosemirror-model";
import type { MarkdownSerializerState } from "../lib/markdown/serializer";
import Node from "./Node";
export default class Text extends Node {
get name() {
return "text";
}
get schema(): NodeSpec {
return {
group: "inline",
};
}
toMarkdown(state: MarkdownSerializerState, node: ProsemirrorNode) {
const text = node.text || "";
if (!state.inAutolink) {
state.text(text, true);
return;
}
// Autolink text is not escaped, except pipes that would split a table cell.
state.text(state.inTable ? text.split("|").join("\\|") : text, false);
}
}