#!/bin/bash
# Fix Mermaid blocks in HTML generated by Pandoc
# Pandoc wraps mermaid code in <pre class="mermaid"><code>...</code></pre>
# But Mermaid.js needs <pre class="mermaid">...</pre> without the <code> tags

sed -i '' 's|<pre class="mermaid"><code>|<pre class="mermaid">|g' "$1"
sed -i '' 's|</code></pre>|</pre>|g' "$1"
