Skip to content

Commit 1237a22

Browse files
committed
Update readme about abc、echarts etc.
1 parent 0e25cb7 commit 1237a22

File tree

1 file changed

+30
-14
lines changed

1 file changed

+30
-14
lines changed

README.md

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,10 @@ Table header can be eliminated.
252252

253253
[Vega and Vega-Lite](https://github.com/jhuix/showdowns/blob/master/docs/showdowns-features.md#vega-and-vega-lite)
254254

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+
255259
See more information, refer to the following document:
256260

257261
[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:
310314
var showdowns = require('showdowns'),
311315
showdowns.init()
312316
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'
315319
});
316320

317321
#### Browser
@@ -348,8 +352,9 @@ Put the following line into your HTML page \<header> or \<body>:
348352
md = md + `\n\n## Showdown's Markdown syntax\n\n` + text;
349353
showdowns.makeHtml(md).then(obj => {
350354
element.innerHTML = obj.html;
351-
showdowns.completedHtml(obj.scripts);
355+
showdowns.completedHtml(obj.scripts, '.showdowns');
352356
}).catch(err =>{
357+
element.innerHTML = '';
353358
console.log(err);
354359
});
355360
})
@@ -358,8 +363,9 @@ Put the following line into your HTML page \<header> or \<body>:
358363
if (md) {
359364
showdowns.makeHtml(md).then(obj => {
360365
element.innerHTML = obj.html;
361-
showdowns.completedHtml(obj.scripts);
366+
showdowns.completedHtml(obj.scripts, '.showdowns');
362367
}).catch(err =>{
368+
element.innerHTML = '';
363369
console.log(err);
364370
});
365371
}
@@ -384,11 +390,14 @@ Default options is described below:
384390
katex: { mathDelimiters: [
385391
{ left: '$$', right: '$$', display: true },
386392
{ 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 },
388398
{ left: '\\(', right: '\\)', display: false },
389399
{ 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 }
392401
]},
393402
vega: { theme: 'vox' }
394403
};
@@ -431,16 +440,12 @@ Default options is described below:
431440
{left: '\\[', right: '\\]'}
432441
],
433442
inline: [
434-
{left: "$", right: "$"},
435443
{left: '\\(', right: '\\)'}
436444
]
437445
},
438446
asciimath: {
439447
display: [ {left: "@@", right: "@@"}],
440-
inline: [
441-
{left: "@ ", right: " @"},
442-
{left: "~ ", right: " ~"},
443-
]
448+
inline: [ {left: "\\$ ", right: "\\$"}]
444449
}
445450
}
446451
}
@@ -620,18 +625,29 @@ A function to init that be created showdown.convertor instance or update default
620625

621626
#### makeHtml
622627

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+
623639
Type: ({type:'zip', content: string} | string,
624640
(csstypes?: {
625641
hasKatex: boolean;
626642
hasRailroad: boolean;
627643
hasSequence: boolean
628-
}) => void) => Promise\<{html, scripts}>
644+
}) => void) => Promise\<{html: string, scripts: [script]}>
629645

630646
A async function to make markdown to html that showdown.convertor converte it in current showdowns instance.
631647

632648
#### completedHtml
633649

634-
Type: ( scripts?: [] | string) => Promise\<boolean>
650+
Type: ( scripts?: [script] | string, scriptContainer?: HTMLElement | string) => Promise\<boolean>
635651

636652
A async function to completed markdown to html that append scripts to dom.
637653

0 commit comments

Comments
 (0)