@@ -252,6 +252,10 @@ Table header can be eliminated.
252
252
253
253
[ Vega and Vega-Lite] ( https://github.com/jhuix/showdowns/blob/master/docs/showdowns-features.md#vega-and-vega-lite )
254
254
255
+ [ Echarts] ( https://github.com/jhuix/showdowns/blob/master/docs/showdowns-features.md#echarts )
256
+
257
+ [ ABCJS] ( https://github.com/jhuix/showdowns/blob/master/docs/showdowns-features.md#abc )
258
+
255
259
See more information, refer to the following document:
256
260
257
261
[ Extensions Examples] ( https://github.com/jhuix/showdowns/blob/master/docs/showdowns-features.md )
@@ -310,8 +314,8 @@ See more information, refer to the following document:
310
314
var showdowns = require('showdowns'),
311
315
showdowns.init()
312
316
var text = '# hello, markdown!',
313
- showdowns.makeHtml(text).then(html => {
314
- //Do something for 'html'
317
+ showdowns.makeHtml(text).then(obj => {
318
+ //Do something for 'obj. html' and 'obj.scripts'
315
319
});
316
320
317
321
#### Browser
@@ -348,8 +352,9 @@ Put the following line into your HTML page \<header> or \<body>:
348
352
md = md + `\n\n## Showdown's Markdown syntax\n\n` + text;
349
353
showdowns.makeHtml(md).then(obj => {
350
354
element.innerHTML = obj.html;
351
- showdowns.completedHtml(obj.scripts);
355
+ showdowns.completedHtml(obj.scripts, '.showdowns' );
352
356
}).catch(err =>{
357
+ element.innerHTML = '';
353
358
console.log(err);
354
359
});
355
360
})
@@ -358,8 +363,9 @@ Put the following line into your HTML page \<header> or \<body>:
358
363
if (md) {
359
364
showdowns.makeHtml(md).then(obj => {
360
365
element.innerHTML = obj.html;
361
- showdowns.completedHtml(obj.scripts);
366
+ showdowns.completedHtml(obj.scripts, '.showdowns' );
362
367
}).catch(err =>{
368
+ element.innerHTML = '';
363
369
console.log(err);
364
370
});
365
371
}
@@ -384,11 +390,14 @@ Default options is described below:
384
390
katex: { mathDelimiters: [
385
391
{ left: '$$', right: '$$', display: true },
386
392
{ left: '\\[', right: '\\]', display: true },
387
- { left: '$', right: '$', display: false },
393
+ { left: "\\begin{equation}", right: "\\end{equation}", display: true },
394
+ { left: "\\begin{align}", right: "\\end{align}", display: true },
395
+ { left: "\\begin{alignat}", right: "\\end{alignat}", display: true },
396
+ { left: "\\begin{gather}", right: "\\end{gather}", display: true },
397
+ { left: "\\begin{CD}", right: "\\end{CD}", display: true },
388
398
{ left: '\\(', right: '\\)', display: false },
389
399
{ left: '@@', right: '@@', display: true, asciimath: true },
390
- { left: '@ ', right: ' @', display: false, asciimath: true },
391
- { left: '~ ', right: ' ~', display: false, asciimath: true }
400
+ { left: "\\$", right: "\\$", display: false, asciimath: true }
392
401
]},
393
402
vega: { theme: 'vox' }
394
403
};
@@ -431,16 +440,12 @@ Default options is described below:
431
440
{left: '\\[', right: '\\]'}
432
441
],
433
442
inline: [
434
- {left: "$", right: "$"},
435
443
{left: '\\(', right: '\\)'}
436
444
]
437
445
},
438
446
asciimath: {
439
447
display: [ {left: "@@", right: "@@"}],
440
- inline: [
441
- {left: "@ ", right: " @"},
442
- {left: "~ ", right: " ~"},
443
- ]
448
+ inline: [ {left: "\\$ ", right: "\\$"}]
444
449
}
445
450
}
446
451
}
@@ -620,18 +625,29 @@ A function to init that be created showdown.convertor instance or update default
620
625
621
626
#### makeHtml
622
627
628
+ Type: interface script {
629
+ outer?:[
630
+ {name: string , src: string }
631
+ ] ,
632
+ id?: string ,
633
+ code?: string ,
634
+ inner?:[
635
+ {id: string , code: string }
636
+ ]
637
+ }
638
+
623
639
Type: ({type:'zip', content: string} | string,
624
640
(csstypes?: {
625
641
hasKatex: boolean;
626
642
hasRailroad: boolean;
627
643
hasSequence: boolean
628
- }) => void) => Promise\< {html, scripts}>
644
+ }) => void) => Promise\< {html: string , scripts: [ script ] }>
629
645
630
646
A async function to make markdown to html that showdown.convertor converte it in current showdowns instance.
631
647
632
648
#### completedHtml
633
649
634
- Type: ( scripts?: [ ] | string) => Promise\< boolean>
650
+ Type: ( scripts?: [ script ] | string, scriptContainer?: HTMLElement | string) => Promise\< boolean>
635
651
636
652
A async function to completed markdown to html that append scripts to dom.
637
653
0 commit comments