import { nodeTypeFactory } from "../../../../utils/schema.js";
export const horizontalRuleNodeName = 'horizontal_rule';
export const horizontalRuleMarkupAttr = 'markup';
export const horizontalRuleType = nodeTypeFactory(horizontalRuleNodeName);
export const HorizontalRuleSpecs = (builder) => {
    builder.addNode(horizontalRuleNodeName, () => ({
        spec: {
            attrs: { [horizontalRuleMarkupAttr]: { default: '---' } },
            group: 'block',
            parseDOM: [{ tag: 'hr' }],
            toDOM() {
                return ['div', ['hr']];
            },
            selectable: true,
        },
        fromMd: {
            tokenName: 'hr',
            tokenSpec: {
                name: horizontalRuleNodeName,
                type: 'node',
                getAttrs: (token) => ({ [horizontalRuleMarkupAttr]: token.markup }),
            },
        },
        toMd: (state, node) => {
            state.write(node.attrs[horizontalRuleMarkupAttr]);
            state.closeBlock(node);
        },
    }));
};
//# sourceMappingURL=index.js.map
