Commonmark preset for milkdown.
import { Editor } from '@milkdown/kit/core'
import { commonmark } from '@milkdown/kit/preset/commonmark'
Editor.make().use(commonmark).create()@commonmark
The context with the name attr is used to set the attributes of the node and mark.
You can set the attributes by setting the attr in editor.config.
For example, you can set the data-test-id and class of all the paragraph nodes.
import { commonmark, paragraphAttr } from '@milkdown/kit/preset/commonmark'
Editor.make()
.config((ctx) => {
ctx.set(paragraphAttr.key, {
'data-test-id': uuid(),
class: 'paragraph',
})
})
.use(commonmark)
.create()@docSchema
@textSchema
@paragraphAttr @paragraphSchema @turnIntoTextCommand @paragraphKeymap
@headingAttr @headingSchema @headingIdGenerator @wrapInHeadingInputRule @wrapInHeadingCommand @downgradeHeadingCommand @headingKeymap
@imageAttr @imageSchema @insertImageCommand @updateImageCommand @insertImageInputRule
@blockquoteAttr @blockquoteSchema @wrapInBlockquoteInputRule @wrapInBlockquoteCommand @blockquoteKeymap
@orderedListAttr @orderedListSchema @wrapInOrderedListInputRule @wrapInOrderedListCommand @orderedListKeymap
@bulletListAttr @bulletListSchema @wrapInBulletListInputRule @wrapInBulletListCommand @bulletListKeymap
@listItemAttr @listItemSchema @sinkListItemCommand @liftListItemCommand @splitListItemCommand @liftFirstListItemCommand @listItemKeymap
@codeBlockAttr @codeBlockSchema @createCodeBlockInputRule @createCodeBlockCommand @updateCodeBlockLanguageCommand @codeBlockKeymap
@hardbreakAttr @hardbreakSchema @insertHardbreakCommand @hardbreakKeymap
@hrAttr @hrSchema @insertHrInputRule @insertHrCommand
@htmlAttr @htmlSchema
@emphasisAttr @emphasisSchema @toggleEmphasisCommand @emphasisKeymap @emphasisStarInputRule @emphasisUnderscoreInputRule
@strongAttr @strongSchema @toggleStrongCommand @strongKeymap @strongInputRule
@inlineCodeAttr @inlineCodeSchema @toggleInlineCodeCommand @inlineCodeKeymap @inlineCodeInputRule
@linkAttr @linkSchema @toggleLinkCommand @updateLinkCommand
@isMarkSelectedCommand @isNodeSelectedCommand @clearTextInCurrentBlockCommand @setBlockTypeCommand @wrapInBlockTypeCommand @addBlockTypeCommand @selectTextNearPosCommand
@inlineNodesCursorPlugin
@hardbreakFilterPlugin @hardbreakFilterNodes
@syncHeadingIdPlugin
@syncListOrderPlugin
@hardbreakClearMarkPlugin
@remarkInlineLinkPlugin @remarkAddOrderInListPlugin @remarkLineBreak @remarkMarker