pantsdown 2.3.0 → 2.3.2

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pantsdown",
3
- "version": "2.3.0",
3
+ "version": "2.3.2",
4
4
  "description": "Markdown to 'GitHub HTML' parser",
5
5
  "license": "MIT",
6
6
  "author": "wallpants",
@@ -128,7 +128,7 @@
128
128
  color: inherit;
129
129
  }
130
130
 
131
- .pantsdown .markdown-alert span {
131
+ .pantsdown .markdown-alert > span {
132
132
  font-weight: 500;
133
133
  display: flex;
134
134
  align-items: center;
@@ -138,34 +138,34 @@
138
138
  .pantsdown .markdown-alert-note {
139
139
  border-color: var(--color-accent-fg);
140
140
  }
141
- .pantsdown .markdown-alert-note span {
141
+ .pantsdown .markdown-alert-note > span {
142
142
  color: var(--color-accent-fg);
143
143
  }
144
144
 
145
145
  .pantsdown .markdown-alert-important {
146
146
  border-color: var(--color-done-fg);
147
147
  }
148
- .pantsdown .markdown-alert-important span {
148
+ .pantsdown .markdown-alert-important > span {
149
149
  color: var(--color-done-fg);
150
150
  }
151
151
 
152
152
  .pantsdown .markdown-alert-warning {
153
153
  border-color: var(--color-attention-fg);
154
154
  }
155
- .pantsdown .markdown-alert-warning span {
155
+ .pantsdown .markdown-alert-warning > span {
156
156
  color: var(--color-attention-fg);
157
157
  }
158
158
 
159
159
  .pantsdown .markdown-alert-tip {
160
160
  border-color: var(--color-success-fg);
161
161
  }
162
- .pantsdown .markdown-alert-tip span {
162
+ .pantsdown .markdown-alert-tip > span {
163
163
  color: var(--color-success-fg);
164
164
  }
165
165
  .pantsdown .markdown-alert-caution {
166
166
  border-color: var(--color-danger-fg);
167
167
  }
168
- .pantsdown .markdown-alert-caution span {
168
+ .pantsdown .markdown-alert-caution > span {
169
169
  color: var(--color-danger-fg);
170
170
  }
171
171
  .pantsdown .copy-button {
package/src/javascript.ts CHANGED
@@ -308,7 +308,7 @@ function mermaidScript(config: PantsdownConfig["renderer"]["mermaid"]): string {
308
308
  // prefer the canvas svg: if a consumer re-injects html that was
309
309
  // serialized after a previous setup, the diagram svg sits inside
310
310
  // the old wrapper and stale button icons are svgs too
311
- const svg = el.querySelector(".mermaid-canvas svg") ?? el.querySelector("svg");
311
+ const svg = el.querySelector(".mermaid-canvas svg") ?? el.querySelector(":scope > svg");
312
312
  if (!svg) return;
313
313
 
314
314
  // serialized html loses event listeners, so stale wrappers and
@@ -342,14 +342,16 @@ function mermaidScript(config: PantsdownConfig["renderer"]["mermaid"]): string {
342
342
  }
343
343
 
344
344
  // mermaid renders asynchronously (the page loads mermaid.js separately),
345
- // so wait for the svg to replace the diagram source
345
+ // so wait for the svg to replace the diagram source. Only a direct-child
346
+ // svg counts: mermaid.run() renders in place via a nested temp div
347
+ // whose skeleton svg must not be grabbed mid-render
346
348
  function whenRendered(el, cb) {
347
- if (el.querySelector("svg")) {
349
+ if (el.querySelector(":scope > svg")) {
348
350
  cb();
349
351
  return;
350
352
  }
351
353
  const observer = new MutationObserver(() => {
352
- if (el.querySelector("svg")) {
354
+ if (el.querySelector(":scope > svg")) {
353
355
  observer.disconnect();
354
356
  cb();
355
357
  }