mirror of
https://github.com/bmad-code-org/BMAD-METHOD.git
synced 2026-01-30 04:32:02 +00:00
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:
@@ -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
|
// Process anchor tags with href attribute
|
||||||
if (node.tagName === 'a' && node.properties?.href) {
|
if (node.tagName === 'a' && node.properties?.href) {
|
||||||
const href = node.properties.href;
|
const href = node.properties.href;
|
||||||
|
|||||||
Reference in New Issue
Block a user