fix(build): add iframe support to rehype base path plugin

Allows iframe src attributes to be properly transformed with the base path,
enabling the interactive workflow diagram to be embedded in markdown pages.
This commit is contained in:
Brian Madison
2026-01-25 22:43:00 -06:00
parent d0c9cd7b0b
commit 9168e00167

View File

@@ -39,6 +39,18 @@ export default function rehypeBasePaths(options = {}) {
}
}
// Process iframe tags with src attribute
if (node.tagName === 'iframe' && node.properties?.src) {
const src = node.properties.src;
if (typeof src === 'string' && src.startsWith('/') && !src.startsWith('//')) {
// Don't transform if already has the base path
if (normalizedBase !== '/' && !src.startsWith(normalizedBase)) {
node.properties.src = normalizedBase + src.slice(1);
}
}
}
// Process anchor tags with href attribute
if (node.tagName === 'a' && node.properties?.href) {
const href = node.properties.href;