import { markTypeFactory } from "../../../../utils/schema.js";
export const boldMarkName = 'strong';
export const boldType = markTypeFactory(boldMarkName);
export const BoldAttrs = {
    Markup: 'data-markup',
};
const defaultMarkup = '**';
export const BoldSpecs = (builder) => {
    builder.addMark(boldMarkName, () => ({
        spec: {
            attrs: { [BoldAttrs.Markup]: { default: defaultMarkup } },
            parseDOM: [
                { tag: 'b' },
                {
                    tag: 'strong',
                    getAttrs: (node) => ({
                        [BoldAttrs.Markup]: node.getAttribute(BoldAttrs.Markup),
                    }),
                },
                {
                    style: 'font-weight',
                    getAttrs: (value) => /^(bold(er)?|[5-9]\d{2,})$/.test(value) && null,
                },
            ],
            toDOM(mark) {
                return ['strong', mark.attrs];
            },
        },
        fromMd: {
            tokenSpec: {
                name: boldMarkName,
                type: 'mark',
                getAttrs: (token) => ({
                    [BoldAttrs.Markup]: token.markup,
                }),
            },
        },
        toMd: { open: getMarkup, close: getMarkup, mixable: true, expelEnclosingWhitespace: true },
    }));
};
function getMarkup(_, mark) {
    const attr = mark.attrs[BoldAttrs.Markup];
    return attr || defaultMarkup;
}
//# sourceMappingURL=index.js.map
