"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ItalicSpecs = exports.ItalicAttrs = exports.italicType = exports.italicMarkName = void 0;
const schema_1 = require("../../../../utils/schema.js");
exports.italicMarkName = 'em';
exports.italicType = (0, schema_1.markTypeFactory)(exports.italicMarkName);
exports.ItalicAttrs = {
    Markup: 'data-markup',
};
const defaultMarkup = '*';
const ItalicSpecs = (builder) => {
    builder.addMark(exports.italicMarkName, () => ({
        spec: {
            attrs: { [exports.ItalicAttrs.Markup]: { default: defaultMarkup } },
            parseDOM: [
                { tag: 'i' },
                {
                    tag: 'em',
                    getAttrs: (node) => ({
                        [exports.ItalicAttrs.Markup]: node.getAttribute(exports.ItalicAttrs.Markup),
                    }),
                },
                { style: 'font-style', getAttrs: (value) => value === 'italic' && null },
            ],
            toDOM(mark) {
                return ['em', mark.attrs];
            },
        },
        toMd: { open: getMarkup, close: getMarkup, mixable: true, expelEnclosingWhitespace: true },
        fromMd: {
            tokenSpec: {
                name: exports.italicMarkName,
                type: 'mark',
                getAttrs: (token) => ({
                    [exports.ItalicAttrs.Markup]: token.markup,
                }),
            },
        },
    }));
};
exports.ItalicSpecs = ItalicSpecs;
function getMarkup(_, mark) {
    const attr = mark.attrs[exports.ItalicAttrs.Markup];
    return attr || defaultMarkup;
}
//# sourceMappingURL=index.js.map
