Use data- attributes to preserve macro configs

This commit is contained in:
gsb
2026-04-29 05:19:17 +00:00
parent 2b88d2c10b
commit 98719ec8cd
3 changed files with 121 additions and 70 deletions
+2 -6
View File
@@ -52,13 +52,9 @@ export class HopDown {
// Build macro tags if macros are provided
this.macroMap = new Map();
if (options.macros && options.macros.length > 0) {
const { blockTag, selectorEntries, macroMap } = buildMacroTags(options.macros);
const { blockTag, selectorTag, macroMap } = buildMacroTags(options.macros);
this.macroMap = macroMap;
tagMap = {
...tagMap,
...selectorEntries,
};
// Insert macro block tag — will be placed after fencedCode below
tagMap['[data-macro]'] = selectorTag;
tagMap['_macro'] = blockTag;
}