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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "marked-abc",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "Render sheet music with ABCjs in Markdown documents using Marked.",
5
5
  "main": "./lib/index.esm.js",
6
6
  "module": "./lib/index.esm.js",
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 abc of abcElements) {
92
- const match = document.querySelector(`#${abc.id}`);
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
- console.log(abc);
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