/** * Removes the tags caused by underscores in the {#id_with_underscores} * @param html */ const cleanHeaders = (html: string): string => { return html.replace( /(.*?)(\{#.*?<\/?em>.*?})/g, (_, level, title, tag) => `${title} ${tag.replace(/<\/?em>/g, '_')}` ); }; export default cleanHeaders;