"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SuperscriptSpecs = exports.superscriptType = exports.superscriptMarkName = void 0;
const tslib_1 = require("tslib");
const log_js_1 = require("@diplodoc/transform/lib/log.js");
const sup_js_1 = tslib_1.__importDefault(require("@diplodoc/transform/lib/plugins/sup.js"));
const schema_1 = require("../../../../utils/schema.js");
exports.superscriptMarkName = 'sup';
exports.superscriptType = (0, schema_1.markTypeFactory)(exports.superscriptMarkName);
const SuperscriptSpecs = (builder) => {
    builder
        .configureMd((md) => md.use(sup_js_1.default, { log: log_js_1.log }))
        .addMark(exports.superscriptMarkName, () => ({
        spec: {
            excludes: '_',
            parseDOM: [{ tag: 'sup' }],
            toDOM() {
                return ['sup'];
            },
        },
        toMd: {
            open: (state) => {
                state.escapeWhitespace = true;
                return '^';
            },
            close: (state) => {
                state.escapeWhitespace = false;
                return '^';
            },
            mixable: true,
            expelEnclosingWhitespace: true,
        },
        fromMd: { tokenSpec: { name: exports.superscriptMarkName, type: 'mark' } },
    }));
};
exports.SuperscriptSpecs = SuperscriptSpecs;
//# sourceMappingURL=index.js.map
