marked-abc 0.2.0 → 0.2.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/lib/index.esm.js +5 -5
- package/lib/index.esm.js.map +3 -3
- package/lib/index.umd.js +5 -5
- package/lib/index.umd.js.map +3 -3
- package/package.json +1 -1
- package/src/index.ts +3 -10
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -77,8 +77,6 @@ type AbcToken = {
|
|
|
77
77
|
export default function(
|
|
78
78
|
options: MarkedAbcOptions = {},
|
|
79
79
|
): { extension: MarkedExtension, forceRenderAll: () => void } {
|
|
80
|
-
const abcElements: { id: string, score: string }[] = [];
|
|
81
|
-
|
|
82
80
|
// Can only be run in browser.
|
|
83
81
|
/* node:coverage disable */
|
|
84
82
|
/**
|
|
@@ -88,11 +86,8 @@ export default function(
|
|
|
88
86
|
* mount if the markdown was originally rendered server-side (where ABCjs will not run).
|
|
89
87
|
*/
|
|
90
88
|
function forceRenderAll() {
|
|
91
|
-
for (const
|
|
92
|
-
|
|
93
|
-
if (match) {
|
|
94
|
-
abcjs.renderAbc(match, abc.score, options.abcOptions);
|
|
95
|
-
}
|
|
89
|
+
for (const match of document.querySelectorAll('.abc-score')) {
|
|
90
|
+
abcjs.renderAbc(match, match.textContent, options.abcOptions);
|
|
96
91
|
}
|
|
97
92
|
}
|
|
98
93
|
/* node:coverage enable */
|
|
@@ -123,7 +118,7 @@ export default function(
|
|
|
123
118
|
.split('\n')
|
|
124
119
|
.map((line) => line.trim())
|
|
125
120
|
.join('\n');
|
|
126
|
-
|
|
121
|
+
|
|
127
122
|
return {
|
|
128
123
|
type: 'abcScore',
|
|
129
124
|
raw,
|
|
@@ -135,8 +130,6 @@ export default function(
|
|
|
135
130
|
const eleId = `abc-score-${++scoreCounter}`;
|
|
136
131
|
const sanitize = options.sanitizer ?? escape;
|
|
137
132
|
|
|
138
|
-
abcElements.push({ id: eleId, score: (token as AbcToken).abc });
|
|
139
|
-
|
|
140
133
|
// Unreachable during tests due to missing DOM
|
|
141
134
|
// JS moment: the coverage ignore comment is not included in its own ignore meaning I need
|
|
142
135
|
// to place it before this if statement, meaning the coverage of the if statement itself is
|