"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getNodeAttrs = exports.headingType = exports.headingRule = exports.hasParentHeading = void 0;
const const_1 = require("../const.js");
var utils_1 = require("../../../markdown/Heading/utils.js");
Object.defineProperty(exports, "hasParentHeading", { enumerable: true, get: function () { return utils_1.hasParentHeading; } });
Object.defineProperty(exports, "headingRule", { enumerable: true, get: function () { return utils_1.headingRule; } });
var HeadingSpecs_1 = require("../../../markdown/Heading/HeadingSpecs/index.js");
Object.defineProperty(exports, "headingType", { enumerable: true, get: function () { return HeadingSpecs_1.headingType; } });
// const slug = require('slugify');
const getNodeAttrs = (level) => (node) => ({
    [const_1.YfmHeadingAttr.Level]: level,
    [const_1.YfmHeadingAttr.Id]: node.getAttribute('id') || '',
    [const_1.YfmHeadingAttr.Folding]: getFoldingAttr(node),
});
exports.getNodeAttrs = getNodeAttrs;
function getFoldingAttr(node) {
    const value = node.getAttribute(`data-${const_1.YfmHeadingAttr.Folding}`);
    if (value === 'true')
        return true;
    if (value === 'false')
        return false;
    return null;
}
// export const slugify = (str: string) =>
//     // same config as in yfm-transform
//     // https://github.com/yandex-cloud/yfm-transform/blob/master/lib/plugins/anchors/index.js#L97-L100
//     slug(str, {
//         lower: true,
//         remove: /[*+~.()'"!:@]/g,
//     });
//# sourceMappingURL=utils.js.map
