@kklab/json2markdown 0.0.8 → 0.0.10
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 +18 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -13,10 +13,18 @@ import { Converter } from '@kklab/json2markdown';
|
|
|
13
13
|
|
|
14
14
|
const output = Converter.toMarkdown({
|
|
15
15
|
'Hello, World!': 'It works!',
|
|
16
|
+
}, {
|
|
17
|
+
onConvert: (element) => {
|
|
18
|
+
if (element.tag === 'heading') {
|
|
19
|
+
element.level += 1;
|
|
20
|
+
}
|
|
21
|
+
return element;
|
|
22
|
+
},
|
|
16
23
|
});
|
|
24
|
+
|
|
17
25
|
console.log(output);
|
|
18
26
|
// Output:
|
|
19
|
-
//
|
|
27
|
+
// ## Hello, World!\n\nIt works!\n\n
|
|
20
28
|
```
|
|
21
29
|
|
|
22
30
|
### Using with UMD Modules
|
|
@@ -28,10 +36,18 @@ Include the UMD script in your HTML file and use it:
|
|
|
28
36
|
<script>
|
|
29
37
|
const output = window.JSON2MD.Converter.toMarkdown({
|
|
30
38
|
'Hello, World!': 'It works!',
|
|
39
|
+
}, {
|
|
40
|
+
onConvert: (element) => {
|
|
41
|
+
if (element.tag === 'heading') {
|
|
42
|
+
element.level += 1;
|
|
43
|
+
}
|
|
44
|
+
return element;
|
|
45
|
+
},
|
|
31
46
|
});
|
|
47
|
+
|
|
32
48
|
console.log(JSON.stringify(output));
|
|
33
49
|
// Output:
|
|
34
|
-
//
|
|
50
|
+
// ## Hello, World!\n\nIt works!\n\n
|
|
35
51
|
</script>
|
|
36
52
|
```
|
|
37
53
|
|