feat: code blocks beta

This commit is contained in:
obvTiger 2025-03-27 17:28:51 +01:00
parent 362b7aa15e
commit 1ecb6d8682
19 changed files with 756 additions and 94 deletions

View file

@ -49,6 +49,22 @@ class ButtonElementGenerator {
let attributes = "";
const idProp = node.props.find((p) => typeof p === "string" && p.startsWith("id:"));
if (idProp) {
const idValue = idProp.substring(idProp.indexOf(":") + 1).trim().replace(/^"|"$/g, "");
attributes += ` id="${idValue}"`;
node.elementId = idValue;
if (this.options.debug) {
console.log(`[ButtonElementGenerator] Added explicit ID attribute: ${idValue}`);
}
}
else if (node.elementId) {
attributes += ` id="${node.elementId}"`;
if (this.options.debug) {
console.log(`[ButtonElementGenerator] Adding generated ID attribute: ${node.elementId}`);
}
}
if (node.parent?.tag === "link") {
const linkInfo = this.linkProcessor.processLink(node.parent);
attributes += this.linkProcessor.getButtonClickHandler(linkInfo);