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