marked-abc 0.1.2 → 0.1.3

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.1.2",
3
+ "version": "0.1.3",
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
@@ -93,7 +93,14 @@ export default function(options: MarkedAbcOptions = {}): MarkedExtension {
93
93
  }
94
94
  const end = endMatch.index + endMatch[0].length;
95
95
  const raw = src.slice(0, end);
96
- const abc = raw.replace(SCORE_OPEN_BEGIN, '').replace(SCORE_CLOSE, '');
96
+ const abc = raw
97
+ .replace(SCORE_OPEN_BEGIN, '')
98
+ .replace(SCORE_CLOSE, '')
99
+ .trim()
100
+ .split('\n')
101
+ .map((line) => line.trim())
102
+ .join('\n');
103
+ console.log(abc);
97
104
  return {
98
105
  type: 'abcScore',
99
106
  raw,
@@ -115,7 +122,7 @@ export default function(options: MarkedAbcOptions = {}): MarkedExtension {
115
122
  abcjs.renderAbc(
116
123
  ele,
117
124
  // Trim all leading whitespace or ABCjs freaks out and fails to render it all
118
- (token as AbcToken).abc.split('\n').map((line: string) => line.trim()).join('\n'),
125
+ (token as AbcToken).abc,
119
126
  options.abcOptions,
120
127
  );
121
128
  });