This commit is contained in:
Timothy Jaeryang Baek
2026-03-21 17:26:30 -05:00
parent 53b8a1f71b
commit 4f0e574201

View File

@@ -889,13 +889,19 @@ export const removeDetails = (content, types) => {
);
}
return segment;
});
}).trim();
};
export const removeAllDetails = (content) => {
// First pass: strip <details> blocks on the full string before code-fence
// splitting, so blocks whose body contains triple backticks are caught.
// (replaceOutsideCode splits on ``` fences, which breaks the <details>
// regex when the opening and closing tags land in different segments.)
content = content.replace(/<details[^>]*>[\s\S]*?<\/details>/gi, '');
// Second pass: catch any remaining blocks that live outside code fences
return replaceOutsideCode(content, (segment) => {
return segment.replace(/<details[^>]*>.*?<\/details>/gis, '');
});
}).trim();
};
export const processDetails = (content) => {