marked-abc 0.1.3 → 0.2.0

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/README.md CHANGED
@@ -14,7 +14,7 @@ import markedAbc from "marked-abc";
14
14
 
15
15
  const marked = new Marked();
16
16
 
17
- marked.use(markedAbc());
17
+ marked.use(markedAbc().extension);
18
18
 
19
19
  marked.parse(`
20
20
  <score lang="ABC">
@@ -30,6 +30,20 @@ marked.parse(`
30
30
  // Beautifully formatted sheet music as the output
31
31
  ```
32
32
 
33
+ ## Usage with server-side rendering
34
+
35
+ When this extension is used in a server-side context, it will fall back to
36
+ rendering plaintext. When the Markdown element is mounted, you can convert these
37
+ elements to rendered notation by using the returned `forceRenderAll` function.
38
+
39
+ ```js
40
+ const abc = markedAbc();
41
+
42
+ marked.use(abc.extension);
43
+
44
+ onMount(() => abc.forceRenderAll());
45
+ ```
46
+
33
47
  ## Options
34
48
 
35
49
  * `abcOptions`: [options for `abcjs.renderAbc`](https://docs.abcjs.net/visual/render-abc-options.html)
package/lib/index.d.ts CHANGED
@@ -9,7 +9,10 @@ export type MarkedAbcOptions = {
9
9
  /** Sanitizer function */
10
10
  sanitizer?: (text: string) => string;
11
11
  };
12
- declare function _default(options?: MarkedAbcOptions): MarkedExtension;
12
+ declare function _default(options?: MarkedAbcOptions): {
13
+ extension: MarkedExtension;
14
+ forceRenderAll: () => void;
15
+ };
13
16
 
14
17
  export {
15
18
  _default as default,