"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SubscriptSpecs = exports.subscriptType = exports.subscriptMarkName = void 0;
const tslib_1 = require("tslib");
const markdown_it_sub_1 = tslib_1.__importDefault(require("markdown-it-sub"));
const schema_1 = require("../../../../utils/schema.js");
exports.subscriptMarkName = 'sub';
exports.subscriptType = (0, schema_1.markTypeFactory)(exports.subscriptMarkName);
const SubscriptSpecs = (builder) => {
    builder
        .configureMd((md) => md.use(markdown_it_sub_1.default))
        .addMark(exports.subscriptMarkName, () => ({
        spec: {
            excludes: '_',
            parseDOM: [{ tag: 'sub' }],
            toDOM() {
                return ['sub'];
            },
        },
        toMd: {
            open: (state) => {
                state.escapeWhitespace = true;
                return '~';
            },
            close: (state) => {
                state.escapeWhitespace = false;
                return '~';
            },
            mixable: false,
            expelEnclosingWhitespace: true,
        },
        fromMd: { tokenSpec: { name: exports.subscriptMarkName, type: 'mark' } },
    }));
};
exports.SubscriptSpecs = SubscriptSpecs;
//# sourceMappingURL=index.js.map
