@milkdown/preset-commonmark
Advanced tools
Comparing version 4.3.0 to 4.4.0
# @milkdown/preset-commonmark | ||
## 4.4.0 | ||
### Minor Changes | ||
- 892909e: Use remark to replace markdown-it. | ||
## 4.3.0 | ||
@@ -4,0 +10,0 @@ |
import type { MarkSpec, MarkType } from 'prosemirror-model'; | ||
import { SerializerMark } from '@milkdown/core'; | ||
import { MarkParserSpec, MarkSerializerSpec } from '@milkdown/core'; | ||
import type { InputRule } from 'prosemirror-inputrules'; | ||
@@ -8,9 +8,6 @@ import { CommonMark } from '../utility'; | ||
readonly schema: MarkSpec; | ||
readonly parser: { | ||
mark: string; | ||
isAtom: boolean; | ||
}; | ||
readonly serializer: SerializerMark; | ||
readonly parser: MarkParserSpec; | ||
readonly serializer: MarkSerializerSpec; | ||
readonly inputRules: (markType: MarkType) => InputRule[]; | ||
} | ||
//# sourceMappingURL=code-inline.d.ts.map |
@@ -12,8 +12,14 @@ import { CommonMark, markRule } from '../utility'; | ||
this.parser = { | ||
mark: 'code_inline', | ||
isAtom: true, | ||
match: (node) => node.type === 'inlineCode', | ||
runner: (state, node, markType) => { | ||
state.openMark(markType); | ||
state.addText(node.value); | ||
state.closeMark(markType); | ||
}, | ||
}; | ||
this.serializer = { | ||
open: '`', | ||
close: '`', | ||
match: (mark) => mark.type.name === this.id, | ||
runner: (state, mark) => { | ||
state.withMark(mark, 'emphasis'); | ||
}, | ||
}; | ||
@@ -20,0 +26,0 @@ this.inputRules = (markType) => [markRule(/(?:^|[^`])(`([^`]+)`)$/, markType)]; |
import type { MarkSpec, MarkType } from 'prosemirror-model'; | ||
import type { Keymap } from 'prosemirror-commands'; | ||
import type { InputRule } from 'prosemirror-inputrules'; | ||
import { SerializerMark } from '@milkdown/core'; | ||
import { MarkParserSpec, MarkSerializerSpec } from '@milkdown/core'; | ||
import { CommonMark } from '../utility'; | ||
@@ -9,6 +9,4 @@ export declare class Em extends CommonMark { | ||
readonly schema: MarkSpec; | ||
readonly parser: { | ||
mark: string; | ||
}; | ||
readonly serializer: SerializerMark; | ||
readonly parser: MarkParserSpec; | ||
readonly serializer: MarkSerializerSpec; | ||
readonly inputRules: (markType: MarkType) => InputRule[]; | ||
@@ -15,0 +13,0 @@ readonly keymap: (markType: MarkType) => Keymap; |
@@ -16,7 +16,14 @@ import { toggleMark } from 'prosemirror-commands'; | ||
this.parser = { | ||
mark: 'em', | ||
match: (node) => node.type === 'emphasis', | ||
runner: (state, node, markType) => { | ||
state.openMark(markType); | ||
state.next(node.children); | ||
state.closeMark(markType); | ||
}, | ||
}; | ||
this.serializer = { | ||
open: '*', | ||
close: '*', | ||
match: (mark) => mark.type.name === this.id, | ||
runner: (state, mark) => { | ||
state.withMark(mark, 'emphasis'); | ||
}, | ||
}; | ||
@@ -23,0 +30,0 @@ this.inputRules = (markType) => [ |
import type { MarkSpec, MarkType, Schema } from 'prosemirror-model'; | ||
import { SerializerMark, ParserSpec } from '@milkdown/core'; | ||
import { MarkParserSpec, MarkSerializerSpec } from '@milkdown/core'; | ||
import { InputRule } from 'prosemirror-inputrules'; | ||
@@ -8,6 +8,6 @@ import { CommonMark } from '../utility'; | ||
readonly schema: MarkSpec; | ||
readonly parser: ParserSpec; | ||
readonly serializer: SerializerMark; | ||
readonly parser: MarkParserSpec; | ||
readonly serializer: MarkSerializerSpec; | ||
readonly inputRules: (markType: MarkType, schema: Schema) => InputRule<any>[]; | ||
} | ||
//# sourceMappingURL=link.d.ts.map |
@@ -27,16 +27,19 @@ import { InputRule } from 'prosemirror-inputrules'; | ||
this.parser = { | ||
mark: 'link', | ||
getAttrs: (tok) => ({ | ||
href: tok.attrGet('href'), | ||
title: tok.attrGet('title') || null, | ||
}), | ||
match: (node) => node.type === 'link', | ||
runner: (state, node, markType) => { | ||
const url = node.url; | ||
const title = node.title; | ||
state.openMark(markType, { href: url, title }); | ||
state.next(node.children); | ||
state.closeMark(markType); | ||
}, | ||
}; | ||
this.serializer = { | ||
open: () => '[', | ||
close: (state, mark) => { | ||
const link = state.utils.escape(mark.attrs.href); | ||
const title = mark.attrs.title ? ` ${state.utils.quote(mark.attrs.title)}` : ''; | ||
return `](${link}${title})`; | ||
match: (mark) => mark.type.name === this.id, | ||
runner: (state, mark) => { | ||
state.withMark(mark, 'link', undefined, { | ||
title: mark.attrs.title, | ||
url: mark.attrs.href, | ||
}); | ||
}, | ||
priority: 1, | ||
}; | ||
@@ -43,0 +46,0 @@ this.inputRules = (markType, schema) => [ |
@@ -1,2 +0,2 @@ | ||
import { SerializerMark } from '@milkdown/core'; | ||
import { MarkParserSpec, MarkSerializerSpec } from '@milkdown/core'; | ||
import type { Keymap } from 'prosemirror-commands'; | ||
@@ -9,6 +9,4 @@ import type { InputRule } from 'prosemirror-inputrules'; | ||
readonly schema: MarkSpec; | ||
readonly parser: { | ||
mark: string; | ||
}; | ||
readonly serializer: SerializerMark; | ||
readonly parser: MarkParserSpec; | ||
readonly serializer: MarkSerializerSpec; | ||
readonly inputRules: (markType: MarkType) => InputRule[]; | ||
@@ -15,0 +13,0 @@ readonly keymap: (markType: MarkType) => Keymap; |
@@ -16,7 +16,14 @@ import { toggleMark } from 'prosemirror-commands'; | ||
this.parser = { | ||
mark: this.id, | ||
match: (node) => node.type === 'strong', | ||
runner: (state, node, markType) => { | ||
state.openMark(markType); | ||
state.next(node.children); | ||
state.closeMark(markType); | ||
}, | ||
}; | ||
this.serializer = { | ||
open: '**', | ||
close: '**', | ||
match: (mark) => mark.type.name === this.id, | ||
runner: (state, mark) => { | ||
state.withMark(mark, 'strong'); | ||
}, | ||
}; | ||
@@ -23,0 +30,0 @@ this.inputRules = (markType) => [ |
import type { NodeSpec, NodeType } from 'prosemirror-model'; | ||
import { SerializerNode } from '@milkdown/core'; | ||
import { NodeParserSpec, NodeSerializerSpec } from '@milkdown/core'; | ||
import { CommonNode } from '../utility'; | ||
@@ -7,8 +7,6 @@ export declare class Blockquote extends CommonNode { | ||
readonly schema: NodeSpec; | ||
readonly parser: { | ||
block: string; | ||
}; | ||
readonly serializer: SerializerNode; | ||
readonly parser: NodeParserSpec; | ||
readonly serializer: NodeSerializerSpec; | ||
readonly inputRules: (nodeType: NodeType) => import("prosemirror-inputrules").InputRule<any>[]; | ||
} | ||
//# sourceMappingURL=blockquote.d.ts.map |
@@ -15,6 +15,12 @@ import { wrappingInputRule } from 'prosemirror-inputrules'; | ||
this.parser = { | ||
block: this.id, | ||
match: ({ type }) => type === this.id, | ||
runner: (state, node, type) => { | ||
state.openNode(type).next(node.children).closeNode(); | ||
}, | ||
}; | ||
this.serializer = (state, node) => { | ||
state.wrapBlock('> ', node, () => state.renderContent(node)); | ||
this.serializer = { | ||
match: (node) => node.type.name === this.id, | ||
runner: (state, node) => { | ||
state.openNode('blockquote').next(node.content).closeNode(); | ||
}, | ||
}; | ||
@@ -21,0 +27,0 @@ this.inputRules = (nodeType) => [wrappingInputRule(/^\s*>\s$/, nodeType)]; |
import type { NodeType, NodeSpec } from 'prosemirror-model'; | ||
import { SerializerNode } from '@milkdown/core'; | ||
import { NodeParserSpec, NodeSerializerSpec } from '@milkdown/core'; | ||
import { CommonNode } from '../utility'; | ||
@@ -7,8 +7,6 @@ export declare class BulletList extends CommonNode { | ||
readonly schema: NodeSpec; | ||
readonly parser: { | ||
block: string; | ||
}; | ||
readonly serializer: SerializerNode; | ||
readonly parser: NodeParserSpec; | ||
readonly serializer: NodeSerializerSpec; | ||
inputRules: (nodeType: NodeType) => import("prosemirror-inputrules").InputRule<any>[]; | ||
} | ||
//# sourceMappingURL=bullet-list.d.ts.map |
@@ -16,6 +16,12 @@ import { wrappingInputRule } from 'prosemirror-inputrules'; | ||
this.parser = { | ||
block: this.id, | ||
match: ({ type, ordered }) => type === 'list' && !ordered, | ||
runner: (state, node, type) => { | ||
state.openNode(type).next(node.children).closeNode(); | ||
}, | ||
}; | ||
this.serializer = (state, node) => { | ||
state.renderList(node, ' ', () => '* '); | ||
this.serializer = { | ||
match: (node) => node.type.name === this.id, | ||
runner: (state, node) => { | ||
state.openNode('list', undefined, { ordered: false }).next(node.content).closeNode(); | ||
}, | ||
}; | ||
@@ -22,0 +28,0 @@ this.inputRules = (nodeType) => [wrappingInputRule(/^\s*([-+*])\s$/, nodeType)]; |
import type { NodeSpec, NodeType } from 'prosemirror-model'; | ||
import { ParserSpec, SerializerNode } from '@milkdown/core'; | ||
import { NodeParserSpec, NodeSerializerSpec } from '@milkdown/core'; | ||
import { Keymap } from 'prosemirror-commands'; | ||
@@ -12,4 +12,4 @@ import { CommonNode } from '../utility'; | ||
readonly schema: NodeSpec; | ||
readonly parser: ParserSpec; | ||
readonly serializer: SerializerNode; | ||
readonly parser: NodeParserSpec; | ||
readonly serializer: NodeSerializerSpec; | ||
readonly inputRules: (nodeType: NodeType) => import("prosemirror-inputrules").InputRule<any>[]; | ||
@@ -16,0 +16,0 @@ readonly keymap: () => Keymap; |
@@ -66,12 +66,17 @@ var _CodeFence_instances, _CodeFence_onChangeLanguage, _CodeFence_createSelectElement; | ||
this.parser = { | ||
block: this.id, | ||
getAttrs: (tok) => ({ language: tok.info }), | ||
isAtom: true, | ||
match: ({ type }) => type === 'code', | ||
runner: (state, node, type) => { | ||
const lang = node.lang; | ||
const value = node.value; | ||
state.openNode(type, { language: lang }); | ||
state.addText(value); | ||
state.closeNode(); | ||
}, | ||
}; | ||
this.serializer = (state, node) => { | ||
state.write('```' + node.attrs.language + '\n'); | ||
state.text(node.textContent); | ||
state.ensureNewLine(); | ||
state.write('```'); | ||
state.closeBlock(node); | ||
this.serializer = { | ||
match: (node) => node.type.name === this.id, | ||
runner: (state, node) => { | ||
var _a; | ||
state.addNode('code', undefined, ((_a = node.content.firstChild) === null || _a === void 0 ? void 0 : _a.text) || '', { lang: node.attrs.language }); | ||
}, | ||
}; | ||
@@ -78,0 +83,0 @@ this.inputRules = (nodeType) => [textblockTypeInputRule(/^```$/, nodeType)]; |
import type { Keymap } from 'prosemirror-commands'; | ||
import type { NodeSpec, NodeType } from 'prosemirror-model'; | ||
import { SerializerNode } from '@milkdown/core'; | ||
import { NodeParserSpec, NodeSerializerSpec } from '@milkdown/core'; | ||
import { CommonNode } from '../utility'; | ||
@@ -8,9 +8,6 @@ export declare class HardBreak extends CommonNode { | ||
readonly schema: NodeSpec; | ||
readonly parser: { | ||
block: string; | ||
isAtom: boolean; | ||
}; | ||
readonly serializer: SerializerNode; | ||
readonly parser: NodeParserSpec; | ||
readonly serializer: NodeSerializerSpec; | ||
readonly keymap: (nodeType: NodeType) => Keymap; | ||
} | ||
//# sourceMappingURL=hard-break.d.ts.map |
@@ -14,7 +14,12 @@ import { CommonNode } from '../utility'; | ||
this.parser = { | ||
block: this.id, | ||
isAtom: true, | ||
match: ({ type }) => type === 'break', | ||
runner: (state, _, type) => { | ||
state.addNode(type); | ||
}, | ||
}; | ||
this.serializer = (state) => { | ||
state.write(' \n'); | ||
this.serializer = { | ||
match: (node) => node.type.name === this.id, | ||
runner: (state) => { | ||
state.addNode('break'); | ||
}, | ||
}; | ||
@@ -21,0 +26,0 @@ this.keymap = (nodeType) => ({ |
import type { NodeSpec, NodeType } from 'prosemirror-model'; | ||
import { ParserSpec, SerializerNode } from '@milkdown/core'; | ||
import { NodeParserSpec, NodeSerializerSpec } from '@milkdown/core'; | ||
import { CommonNode } from '../utility/base'; | ||
@@ -7,6 +7,6 @@ export declare class Heading extends CommonNode { | ||
schema: NodeSpec; | ||
parser: ParserSpec; | ||
serializer: SerializerNode; | ||
readonly parser: NodeParserSpec; | ||
readonly serializer: NodeSerializerSpec; | ||
inputRules: (nodeType: NodeType) => import("prosemirror-inputrules").InputRule<any>[]; | ||
} | ||
//# sourceMappingURL=heading.d.ts.map |
@@ -26,9 +26,17 @@ import { textblockTypeInputRule } from 'prosemirror-inputrules'; | ||
this.parser = { | ||
block: this.id, | ||
getAttrs: (tok) => ({ level: Number(tok.tag.slice(1)) }), | ||
match: ({ type }) => type === this.id, | ||
runner: (state, node, type) => { | ||
const depth = node.depth; | ||
state.openNode(type, { level: depth }); | ||
state.next(node.children); | ||
state.closeNode(); | ||
}, | ||
}; | ||
this.serializer = (state, node) => { | ||
state.write(`${state.utils.repeat('#', node.attrs.level)} `); | ||
state.renderInline(node); | ||
state.closeBlock(node); | ||
this.serializer = { | ||
match: (node) => node.type.name === this.id, | ||
runner: (state, node) => { | ||
state.openNode('heading', undefined, { depth: node.attrs.level }); | ||
state.next(node.content); | ||
state.closeNode(); | ||
}, | ||
}; | ||
@@ -35,0 +43,0 @@ this.inputRules = (nodeType) => headingIndex.map((x) => textblockTypeInputRule(new RegExp(`^(#{1,${x}})\\s$`), nodeType, () => ({ |
import type { NodeSpec, NodeType } from 'prosemirror-model'; | ||
import { SerializerNode } from '@milkdown/core'; | ||
import type { NodeParserSpec, NodeSerializerSpec } from '@milkdown/core'; | ||
import { InputRule } from 'prosemirror-inputrules'; | ||
@@ -8,9 +8,6 @@ import { CommonNode } from '../utility'; | ||
readonly schema: NodeSpec; | ||
readonly parser: { | ||
block: string; | ||
isAtom: boolean; | ||
}; | ||
readonly serializer: SerializerNode; | ||
readonly parser: NodeParserSpec; | ||
readonly serializer: NodeSerializerSpec; | ||
readonly inputRules: (nodeType: NodeType) => InputRule<any>[]; | ||
} | ||
//# sourceMappingURL=hr.d.ts.map |
@@ -13,8 +13,12 @@ import { InputRule } from 'prosemirror-inputrules'; | ||
this.parser = { | ||
block: this.id, | ||
isAtom: true, | ||
match: ({ type }) => type === 'thematicBreak', | ||
runner: (state, _, type) => { | ||
state.addNode(type); | ||
}, | ||
}; | ||
this.serializer = (state, node) => { | ||
state.write('---'); | ||
state.closeBlock(node); | ||
this.serializer = { | ||
match: (node) => node.type.name === this.id, | ||
runner: (state) => { | ||
state.addNode('thematicBreak'); | ||
}, | ||
}; | ||
@@ -21,0 +25,0 @@ this.inputRules = (nodeType) => [ |
import type { NodeSpec, NodeType } from 'prosemirror-model'; | ||
import { ParserSpec, SerializerNode } from '@milkdown/core'; | ||
import { NodeParserSpec, NodeSerializerSpec } from '@milkdown/core'; | ||
import { InputRule } from 'prosemirror-inputrules'; | ||
@@ -8,6 +8,6 @@ import { CommonNode } from '../utility'; | ||
readonly schema: NodeSpec; | ||
readonly parser: ParserSpec; | ||
readonly serializer: SerializerNode; | ||
readonly parser: NodeParserSpec; | ||
readonly serializer: NodeSerializerSpec; | ||
readonly inputRules: (nodeType: NodeType) => InputRule<any>[]; | ||
} | ||
//# sourceMappingURL=image.d.ts.map |
@@ -46,17 +46,25 @@ import { InputRule } from 'prosemirror-inputrules'; | ||
this.parser = { | ||
node: 'image', | ||
getAttrs: (token) => { | ||
var _a, _b; | ||
return ({ | ||
src: token.attrGet('src') || '', | ||
alt: ((_b = (_a = token.children) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.content) || null, | ||
title: token.attrGet('title'), | ||
match: ({ type }) => type === this.id, | ||
runner: (state, node, type) => { | ||
const url = node.url; | ||
const alt = node.alt; | ||
const title = node.title; | ||
state.openNode(type, { | ||
src: url, | ||
alt, | ||
title, | ||
}); | ||
state.next(node.children); | ||
state.closeNode(); | ||
}, | ||
}; | ||
this.serializer = (state, node) => { | ||
const alt = state.utils.escape(node.attrs.alt || ''); | ||
const title = node.attrs.title ? ' ' + state.utils.quote(node.attrs.title) : ''; | ||
const link = state.utils.escape(node.attrs.src) + title; | ||
state.write(`![${alt}](${link}) `); | ||
this.serializer = { | ||
match: (node) => node.type.name === this.id, | ||
runner: (state, node) => { | ||
state.addNode('image', undefined, undefined, { | ||
title: node.attrs.title, | ||
url: node.attrs.src, | ||
alt: node.attrs.alt, | ||
}); | ||
}, | ||
}; | ||
@@ -63,0 +71,0 @@ this.inputRules = (nodeType) => [ |
@@ -11,3 +11,4 @@ import { Paragraph } from './paragraph'; | ||
import { CodeFence } from './code-fence'; | ||
import { TabIndent } from './tab-indent'; | ||
import { Doc } from './doc'; | ||
import { Text } from './text'; | ||
export { Paragraph } from './paragraph'; | ||
@@ -23,4 +24,4 @@ export { Blockquote } from './blockquote'; | ||
export { CodeFence } from './code-fence'; | ||
export { TabIndent } from './tab-indent'; | ||
export declare const nodes: (Paragraph | Blockquote | Heading | Image | Hr | BulletList | ListItem | OrderedList | HardBreak | CodeFence | TabIndent)[]; | ||
export { Text } from './text'; | ||
export declare const nodes: (Paragraph | Blockquote | Heading | Image | Hr | BulletList | ListItem | OrderedList | HardBreak | CodeFence | Doc | Text)[]; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -11,3 +11,4 @@ import { Paragraph } from './paragraph'; | ||
import { CodeFence } from './code-fence'; | ||
import { TabIndent } from './tab-indent'; | ||
import { Doc } from './doc'; | ||
import { Text } from './text'; | ||
export { Paragraph } from './paragraph'; | ||
@@ -23,4 +24,5 @@ export { Blockquote } from './blockquote'; | ||
export { CodeFence } from './code-fence'; | ||
export { TabIndent } from './tab-indent'; | ||
export { Text } from './text'; | ||
export const nodes = [ | ||
new Doc(), | ||
new Paragraph(), | ||
@@ -36,4 +38,4 @@ new HardBreak(), | ||
new Image(), | ||
new TabIndent(), | ||
new Text(), | ||
]; | ||
//# sourceMappingURL=index.js.map |
import type { NodeType, NodeSpec } from 'prosemirror-model'; | ||
import type { Keymap } from 'prosemirror-commands'; | ||
import { SerializerNode } from '@milkdown/core'; | ||
import { NodeParserSpec, NodeSerializerSpec } from '@milkdown/core'; | ||
import { CommonNode } from '../utility'; | ||
@@ -8,8 +8,6 @@ export declare class ListItem extends CommonNode { | ||
readonly schema: NodeSpec; | ||
readonly parser: { | ||
block: string; | ||
}; | ||
readonly serializer: SerializerNode; | ||
readonly parser: NodeParserSpec; | ||
readonly serializer: NodeSerializerSpec; | ||
readonly keymap: (type: NodeType) => Keymap; | ||
} | ||
//# sourceMappingURL=list-item.d.ts.map |
@@ -14,6 +14,16 @@ import { liftListItem, sinkListItem, splitListItem } from 'prosemirror-schema-list'; | ||
this.parser = { | ||
block: this.id, | ||
match: ({ type }) => type === 'listItem', | ||
runner: (state, node, type) => { | ||
state.openNode(type); | ||
state.next(node.children); | ||
state.closeNode(); | ||
}, | ||
}; | ||
this.serializer = (state, node) => { | ||
state.renderContent(node); | ||
this.serializer = { | ||
match: (node) => node.type.name === this.id, | ||
runner: (state, node) => { | ||
state.openNode('listItem'); | ||
state.next(node.content); | ||
state.closeNode(); | ||
}, | ||
}; | ||
@@ -20,0 +30,0 @@ this.keymap = (type) => ({ |
import type { NodeSpec, NodeType } from 'prosemirror-model'; | ||
import { SerializerNode } from '@milkdown/core'; | ||
import { NodeParserSpec, NodeSerializerSpec } from '@milkdown/core'; | ||
import { CommonNode } from '../utility/base'; | ||
@@ -7,8 +7,6 @@ export declare class OrderedList extends CommonNode { | ||
readonly schema: NodeSpec; | ||
readonly parser: { | ||
block: string; | ||
}; | ||
readonly serializer: SerializerNode; | ||
readonly parser: NodeParserSpec; | ||
readonly serializer: NodeSerializerSpec; | ||
readonly inputRules: (nodeType: NodeType) => import("prosemirror-inputrules").InputRule<any>[]; | ||
} | ||
//# sourceMappingURL=ordered-list.d.ts.map |
@@ -33,12 +33,16 @@ import { wrappingInputRule } from 'prosemirror-inputrules'; | ||
this.parser = { | ||
block: this.id, | ||
match: ({ type, ordered }) => type === 'list' && !!ordered, | ||
runner: (state, node, type) => { | ||
state.openNode(type); | ||
state.next(node.children); | ||
state.closeNode(); | ||
}, | ||
}; | ||
this.serializer = (state, node) => { | ||
const { order = 1 } = node.attrs; | ||
const maxWidth = `${order + node.childCount - 1}`.length; | ||
const space = state.utils.repeat(' ', maxWidth + 2); | ||
state.renderList(node, space, (i) => { | ||
const n = `${order + i}`; | ||
return state.utils.repeat(' ', maxWidth - n.length) + n + '. '; | ||
}); | ||
this.serializer = { | ||
match: (node) => node.type.name === this.id, | ||
runner: (state, node) => { | ||
state.openNode('list', undefined, { ordered: true, start: 1 }); | ||
state.next(node.content); | ||
state.closeNode(); | ||
}, | ||
}; | ||
@@ -45,0 +49,0 @@ this.inputRules = (nodeType) => [ |
import type { NodeSpec } from 'prosemirror-model'; | ||
import { SerializerNode } from '@milkdown/core'; | ||
import { NodeParserSpec, NodeSerializerSpec } from '@milkdown/core'; | ||
import { CommonNode } from '../utility/base'; | ||
@@ -7,7 +7,5 @@ export declare class Paragraph extends CommonNode { | ||
readonly schema: NodeSpec; | ||
readonly parser: { | ||
block: string; | ||
}; | ||
readonly serializer: SerializerNode; | ||
readonly parser: NodeParserSpec; | ||
readonly serializer: NodeSerializerSpec; | ||
} | ||
//# sourceMappingURL=paragraph.d.ts.map |
@@ -13,6 +13,21 @@ import { CommonNode } from '../utility/base'; | ||
this.parser = { | ||
block: this.id, | ||
match: (node) => node.type === this.id, | ||
runner: (state, node, type) => { | ||
state.openNode(type); | ||
if (node.children) { | ||
state.next(node.children); | ||
} | ||
else { | ||
state.addText(node.value); | ||
} | ||
state.closeNode(); | ||
}, | ||
}; | ||
this.serializer = (state, node) => { | ||
state.renderInline(node).closeBlock(node); | ||
this.serializer = { | ||
match: (node) => node.type.name === this.id, | ||
runner: (state, node) => { | ||
state.openNode('paragraph'); | ||
state.next(node.content); | ||
state.closeNode(); | ||
}, | ||
}; | ||
@@ -19,0 +34,0 @@ } |
import type { NodeSpec, NodeType } from 'prosemirror-model'; | ||
import type { Keymap } from 'prosemirror-commands'; | ||
import { SerializerNode } from '@milkdown/core'; | ||
import { NodeParserSpec, NodeSerializerSpec } from '@milkdown/core'; | ||
import { CommonNode } from '../utility/base'; | ||
@@ -8,8 +8,6 @@ export declare class TabIndent extends CommonNode { | ||
readonly schema: NodeSpec; | ||
readonly parser: { | ||
block: string; | ||
}; | ||
readonly serializer: SerializerNode; | ||
readonly parser: NodeParserSpec; | ||
readonly serializer: NodeSerializerSpec; | ||
readonly keymap: (nodeType: NodeType) => Keymap; | ||
} | ||
//# sourceMappingURL=tab-indent.d.ts.map |
@@ -14,6 +14,12 @@ import { CommonNode } from '../utility/base'; | ||
this.parser = { | ||
block: this.id, | ||
match: ({ type }) => type === 'tab', | ||
runner: (state, _, type) => { | ||
state.addNode(type); | ||
}, | ||
}; | ||
this.serializer = (state) => { | ||
state.write(' '); | ||
this.serializer = { | ||
match: (node) => node.type.name === this.id, | ||
runner: (state) => { | ||
state.addNode('tab'); | ||
}, | ||
}; | ||
@@ -20,0 +26,0 @@ this.keymap = (nodeType) => ({ |
{ | ||
"name": "@milkdown/preset-commonmark", | ||
"version": "4.3.0", | ||
"version": "4.4.0", | ||
"main": "lib/index.js", | ||
@@ -29,3 +29,3 @@ "module": "lib/index.js", | ||
"devDependencies": { | ||
"@milkdown/core": "4.3.0" | ||
"@milkdown/core": "4.4.0" | ||
}, | ||
@@ -32,0 +32,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
91747
100
1140