/** * Removes the paragraph tags from around callout blocks so they end up being valid HTML * * @param html * @returns */ const cleanCalloutTags = (html: string): string => { // Replace callout

tags with a tag so we can swap it out with the right react component html = html.replace( /

\s*\[(hint|warning|info|alert|notice|note)\](.*?)\[\/\1\]\s*<\/p>/gs, (_, type, content) => `${content}` ); // Replace any

and

tags inside callout tags with
, since the above operation may have // inadvertantly broken some

tags. return html.replace( /.*?<\/callout>/gs, (callout) => callout.replace(/(

|<\/p>)/g, '
') ); }; export default cleanCalloutTags;