@k9n/scully-plugin-toc
Version:
This plugin for scully provides a postRenderer to generate a table of contents for the rendered route content
21 lines • 913 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.validator = void 0;
const scully_1 = require("@scullyio/scully");
const constants_1 = require("./constants");
const validator = async ( /* conf */) => {
const tocConfig = (0, scully_1.getPluginConfig)(constants_1.TocPluginName);
const errors = [];
if (!tocConfig.insertSelector.length) {
errors.push('Option "insertSelector" for "toc" must be a valid string (e.g. "#toc").');
}
if (!tocConfig.blogAreaSelector.length) {
errors.push('Option "blogAreaSelector" for "toc" must be a valid string (e.g. ".blog-content").');
}
if (tocConfig.level && !tocConfig.level.length) {
errors.push(`Option "level" for "toc" must be an array containing headings to list (e.g.: "['h2', 'h3']".`);
}
return errors;
};
exports.validator = validator;
//# sourceMappingURL=validator.js.map