import crypto from 'crypto' import fs from 'fs' import Path from 'path' import cheerio from 'cheerio' // checkSanitizeOptions is only used in dev env // eslint-disable-next-line import/no-extraneous-dependencies import prettier from 'prettier' import sanitizeHtml from 'sanitize-html' import { sanitizeOptions } from '../../../modules/learn/app/src/sanitizeOptions.js' import { fileURLToPath } from 'url' const __dirname = Path.dirname(fileURLToPath(import.meta.url)) const EXTRACT_STYLE = process.env.EXTRACT_STYLES === 'true' const OMIT_STYLE = process.env.OMIT_STYLE !== 'false' const DUMP_CSS_IN = Path.join( Path.dirname(Path.dirname(Path.dirname(__dirname))), 'data', 'dumpFolder' ) function hash(blob) { return crypto.createHash('sha1').update(blob).digest('hex') } function normalize(blob, title) { // styles are dropped in web and kept in wiki pages for previewing there. blob = blob.replace(/