2019-11-19 04:29:29 +01:00
|
|
|
/**
|
|
|
|
* Removes the <em> tags caused by underscores in the {#id_with_underscores}
|
|
|
|
* @param html
|
|
|
|
*/
|
2019-11-14 03:05:03 +01:00
|
|
|
const cleanHeaders = (html: string): string => {
|
|
|
|
return html.replace(
|
|
|
|
/<h([0-9])>(.*?)(\{#.*?<\/?em>.*?})/g,
|
|
|
|
(_, level, title, tag) => `<h${level}>${title} ${tag.replace(/<\/?em>/g, '_')}`
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default cleanHeaders;
|