const cleanHeaders = (html: string): string => { return html.replace( /(.*?)(\{#.*?<\/?em>.*?})/g, (_, level, title, tag) => `${title} ${tag.replace(/<\/?em>/g, '_')}` ); }; export default cleanHeaders;