mnfst 0.5.59 → 0.5.60

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -366,10 +366,19 @@ function initializeCodePlugin() {
366
366
  }
367
367
 
368
368
  connectedCallback() {
369
- this.setupElement();
370
- // Remove tabindex to prevent focusing the container itself
371
- // Focus should go to interactive elements like copy button
372
- this.highlightCode();
369
+ // Idempotency: if the element already has a fully-rendered structure
370
+ // (a <pre><code> child from prerender output), skip the rebuild.
371
+ // Reading innerHTML and re-setting it as textContent (extractContent
372
+ // line ~524) treats the prerendered hljs <span> markup as code
373
+ // source, producing nested highlight-of-highlight output.
374
+ const alreadyRendered =
375
+ this.querySelector(':scope > pre > code') &&
376
+ (this.hasAttribute('data-pre-rendered') ||
377
+ this.querySelector(':scope > pre > code.hljs, :scope > pre > code[data-highlighted="yes"]'));
378
+ if (!alreadyRendered) {
379
+ this.setupElement();
380
+ this.highlightCode();
381
+ }
373
382
  }
374
383
 
375
384
  attributeChangedCallback(name, oldValue, newValue) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mnfst",
3
- "version": "0.5.59",
3
+ "version": "0.5.60",
4
4
  "private": false,
5
5
  "workspaces": [
6
6
  "templates/starter",