/
vshmidt
/
label-studio
Обзор
Документация
Войти
/
vshmidt
/
label-studio
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
develop
docs/scripts/removeContent.js
21 строка
577 B
Hugues Tennier
docs: Remove tier-specific content from the table of content (#4873)
06 окт 2023, 19:58
Не верифицирован
06 окт 2023, 19:58
4a8eb5c
Код
Авторство
О чём код?
var HTMLParser = require("node-html-parser"); module.exports = function (ctx) { return function includeTag(content) { const { config } = ctx; /* If you’re on the OSS site, remove every `.enterprise-only` element. Opposite for the ENT site */ const classToRemove = config.theme_config.tier === "opensource" ? ".enterprise-only" : ".opensource-only"; const template = HTMLParser.parse(content); template.querySelectorAll(classToRemove).forEach((x) => x.remove()); content = template.toString(); return content; }; };