@jhuix/showdowns 0.7.3 → 0.7.5

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
@@ -4,8 +4,6 @@
4
4
 
5
5
  [Showdowns](https://github.com/jhuix/showdowns) is a lib that make markdown to html with some extensions features(include more diagrams extensions) of showdown.js.
6
6
 
7
- **In browser environment, it is implemented to dynamically load js lib files related to more showdown diagrams extension for using [showdowns >= 0.3.0 version](https://github.com/jhuix/showdowns).**
8
-
9
7
  > If you think the showdowns library can help you or also hope to encourage the author, click on the top right corner to give me a [Star](https://github.com/jhuix/showdowns)⭐️.
10
8
 
11
9
  ## Markdown To Html
@@ -14,7 +12,7 @@
14
12
 
15
13
  [Showdown](https://github.com/showdownjs/showdown) is a Javascript Markdown to HTML converter, based on the original works by John Gruber. Showdown can be used client side (in the browser) or server side (with NodeJs). For more information, refer to the following document:
16
14
 
17
- - [Showdowns Features Syntax](https://jhuix.github.io/showdowns/demo/index.html)
15
+ - [Showdowns Features Syntax](https://jhuix.github.io/showdowns)
18
16
  - [Showdown's Markdown Syntax](https://github.com/showdownjs/showdown/wiki/Showdown's-Markdown-syntax)
19
17
  - [Showdown Options](https://github.com/showdownjs/showdown/wiki/Showdown-options)
20
18
 
@@ -228,55 +226,59 @@ Table header can be eliminated.
228
226
 
229
227
  ### Supporting some markdown extension features
230
228
 
231
- [Footnotes](https://github.com/jhuix/showdowns/blob/master/docs/showdowns-features.md#footnotes)
229
+ [Footnotes](https://jhuix.github.io/showdowns/?page=footnotes)
230
+
231
+ [Directives](https://jhuix.github.io/showdowns/?page=directives)
232
232
 
233
- [Directives](https://github.com/jhuix/showdowns/blob/master/docs/showdowns-features.md#directives)
233
+ [CSS defined](https://jhuix.github.io/showdowns/?page=css)
234
234
 
235
- [CSS defined](https://github.com/jhuix/showdowns/blob/master/docs/showdowns-features.md#css-defined)
235
+ [Inline Image](https://jhuix.github.io/showdowns/?page=images)
236
236
 
237
- [Inline Image](https://github.com/jhuix/showdowns/blob/master/docs/showdowns-features.md#inline-image)
237
+ [Content Tabs](https://jhuix.github.io/showdowns/?page=content-tabs)
238
238
 
239
- [Table of Contents](https://github.com/jhuix/showdowns/blob/master/docs/showdowns-features.md#table-of-contents)
239
+ [Page Tabs](https://jhuix.github.io/showdowns/?page=page-tabs)
240
240
 
241
- [LaTeX math and AsciiMath](https://github.com/jhuix/showdowns/blob/master/docs/showdowns-features.md#latex-math-and-asciimath)
241
+ [Table of Contents](https://jhuix.github.io/showdowns/?page=toc)
242
242
 
243
- [Code Block Theme](https://github.com/jhuix/showdowns/blob/master/docs/showdowns-features.md#code-block-theme)
243
+ [LaTeX math and AsciiMath](https://jhuix.github.io/showdowns/?page=math)
244
244
 
245
- [Mermaid](https://github.com/jhuix/showdowns/blob/master/docs/showdowns-features.md#mermaid)
245
+ [Code Blocks Theme](https://jhuix.github.io/showdowns/?page=code-blocks)
246
246
 
247
- [Plantuml](https://github.com/jhuix/showdowns/blob/master/docs/showdowns-features.md#plantuml)
247
+ [Mermaid](https://jhuix.github.io/showdowns/?page=mermaid)
248
248
 
249
- [Flowchart](https://github.com/jhuix/showdowns/blob/master/docs/showdowns-features.md#flowchart)
249
+ [Plantuml](https://jhuix.github.io/showdowns/?page=plantuml)
250
250
 
251
- [Network Sequence](https://github.com/jhuix/showdowns/blob/master/docs/showdowns-features.md#network-sequence)
251
+ [Flowchart](https://jhuix.github.io/showdowns/?page=flowchart)
252
252
 
253
- [Graphviz's dot](https://github.com/jhuix/showdowns/blob/master/docs/showdowns-features.md#graphviz-s-dot)
253
+ [Network Sequence](https://jhuix.github.io/showdowns/?page=sequence)
254
254
 
255
- [Railroad diagrams](https://github.com/jhuix/showdowns/blob/master/docs/showdowns-features.md#railroad-diagrams)
255
+ [Graphviz's dot](https://jhuix.github.io/showdowns/?page=viz)
256
256
 
257
- [WaveDrom](https://github.com/jhuix/showdowns/blob/master/docs/showdowns-features.md#wavedrom)
257
+ [Railroad diagrams](https://jhuix.github.io/showdowns/?page=railroad)
258
258
 
259
- [Vega and Vega-Lite](https://github.com/jhuix/showdowns/blob/master/docs/showdowns-features.md#vega-and-vega-lite)
259
+ [WaveDrom](https://jhuix.github.io/showdowns/?page=wavedrom)
260
260
 
261
- [Echarts](https://github.com/jhuix/showdowns/blob/master/docs/showdowns-features.md#echarts)
261
+ [Vega and Vega-Lite](https://jhuix.github.io/showdowns/?page=vega)
262
262
 
263
- [ABCJS](https://github.com/jhuix/showdowns/blob/master/docs/showdowns-features.md#abc)
263
+ [Echarts](https://jhuix.github.io/showdowns/?page=echarts)
264
264
 
265
- [Kroki](https://github.com/jhuix/showdowns/blob/master/docs/showdowns-features.md#kroki)
265
+ [ABCJS](https://jhuix.github.io/showdowns/?page=abc)
266
266
 
267
- [Plotly](https://github.com/jhuix/showdowns/blob/master/docs/showdowns-features.md#plotly)
267
+ [Kroki](https://jhuix.github.io/showdowns/?page=kroki)
268
268
 
269
- [AntV Infographic](https://github.com/jhuix/showdowns/blob/master/docs/showdowns-features.md#antv-infographic)
269
+ [Plotly](https://jhuix.github.io/showdowns/?page=plotly)
270
270
 
271
- [ZenUML](https://github.com/jhuix/showdowns/blob/master/docs/showdowns-features.md#zenuml)
271
+ [AntV Infographic](https://jhuix.github.io/showdowns/?page=antv)
272
+
273
+ [ZenUML](https://jhuix.github.io/showdowns/?page=zenuml)
272
274
 
273
275
  See more information, refer to the following document:
274
276
 
275
- [Extensions Examples](https://github.com/jhuix/showdowns/blob/master/docs/showdowns-features.md)
277
+ [Extensions Examples](https://jhuix.github.io/showdowns)
276
278
 
277
279
  ### Preview
278
280
 
279
- - View [Extensions Examples](https://github.com/jhuix/showdowns/blob/master/docs/showdowns-features.md) is previewed as [Showdowns Features](https://jhuix.github.io/showdowns/)
281
+ - View Extensions Examples is previewed as [Showdowns Features](https://jhuix.github.io/showdowns/)
280
282
 
281
283
  - View video
282
284
 
@@ -427,7 +429,8 @@ Default options is described below:
427
429
  vega: { theme: 'vox' },
428
430
  tex: { serverUrl: 'tex.io', buildType: 'pdflatex' },
429
431
  shiki: { theme: 'ayu-dark' },
430
- gnuplot: {}
432
+ gnuplot: {},
433
+ pagetabs:{}
431
434
  };
432
435
 
433
436
  - showdown: showdown options object
@@ -552,6 +555,14 @@ Default options is described below:
552
555
  svgRender: (id:string, code:string) => string
553
556
  }
554
557
 
558
+ - pagetabs: page tabs options object
559
+
560
+ For more page tabs options:
561
+
562
+ {
563
+ pageRender: (pageId: string) => void
564
+ }
565
+
555
566
  #### defaultExtensions
556
567
 
557
568
  Type: Array of showdown extensions
@@ -563,6 +574,8 @@ Default extensions is described below:
563
574
  'showdown-image': showdownImage(),
564
575
  'showdown-align': showdownAlign(),
565
576
  'showdown-footnotes': showdownFootnotes(),
577
+ 'showdown-content-tabs': showdownContentTabs(),
578
+ 'showdown-page-tabs': showdownPageTabs(),
566
579
  'showdown-directive': showdownDirective(),
567
580
  'showdown-sequence': showdownSequence()
568
581
  }
@@ -595,7 +608,10 @@ Default async extensions is described below:
595
608
  'showdown-echarts': showdownEcharts(),
596
609
  'showdown-gnuplot': showdownShiki(gnuplotOptions),
597
610
  'showdown-antv': showdownAntV(),
611
+ 'showdown-zenuml': showdownZenuml(),
598
612
  'showdown-sequence': getExtension('showdown-sequence', showdownSequence),
613
+ 'showdown-content-tabs': showdownAsyncContentTabs(),
614
+ 'showdown-page-tabs': showdownAsyncPageTabs(pagetabsOptions),
599
615
  'showdown-shiki': showdownShiki(shikiOptions),
600
616
  'showdow-css': showdownCss(),
601
617
  }
@@ -807,7 +823,17 @@ Type: interface csslink {
807
823
  link: string
808
824
  }
809
825
 
810
- Type: ({type:'zip', content: string, output: 'dom'} | string) => Promise\<{html: string | HTMLElement[], scripts: script[], cssLinks: csslink[]}>
826
+ Type: ({
827
+ type:'zip',
828
+ content: string,
829
+ output: 'dom',
830
+ exclusive: boolean,
831
+ pageRender: (pageId: string) => void
832
+ } | string) => Promise\<{
833
+ html: string | HTMLElement[],
834
+ scripts: script[],
835
+ cssLinks: csslink[]
836
+ }>
811
837
 
812
838
  A async function to make markdown to html that showdown.convertor converte it in current showdowns instance.
813
839
 
package/demo/index.html CHANGED
@@ -5,7 +5,7 @@
5
5
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
6
6
  <meta name="viewport" content="width=device-width,initial-scale=1.0" />
7
7
  <link rel="icon" href="../favicon.ico" />
8
- <title>showdowns demo</title>
8
+ <title>Showdowns Features</title>
9
9
  <style>
10
10
  * {
11
11
  margin: 0;
@@ -41,7 +41,6 @@
41
41
  }
42
42
 
43
43
  .workspace-container {
44
- overflow: hidden;
45
44
  display: flex;
46
45
  flex-direction: column;
47
46
  height: 100%;
@@ -94,7 +93,7 @@
94
93
  let md = "";
95
94
  let mdCssTypes = null;
96
95
  window
97
- .fetch("https://jhuix.github.io/showdowns/showdowns-features.md")
96
+ .fetch("https://jhuix.github.io/showdowns/pages/showdowns.md")
98
97
  .then(function(response) {
99
98
  if (response.ok) {
100
99
  return response.text();
@@ -102,20 +101,12 @@
102
101
  })
103
102
  .then(function(text) {
104
103
  md = text;
105
- return window.fetch("https://jhuix.github.io/showdowns/Showdown's-Markdown-syntax.md");
106
- })
107
- .then(function(response) {
108
- if (response.ok) {
109
- return response.text();
110
- }
111
- })
112
- .then(function(text) {
113
- md = md + `\n\n# Showdown's Markdown syntax\n\n` + text;
114
104
  showdowns
115
105
  .makeHtml({content: md, output: 'dom'}, csstypes => {
116
106
  mdCssTypes = csstypes;
117
107
  })
118
108
  .then(res => {
109
+ element.replaceChildren();
119
110
  if (typeof res === 'object') {
120
111
  if (typeof res.html === 'string') {
121
112
  element.innerHTML = res.html;
@@ -128,6 +119,15 @@
128
119
  } else {
129
120
  element.innerHTML = res;
130
121
  }
122
+
123
+ const urlParams = new URLSearchParams(window.location.search);
124
+ const pageName = urlParams.get('page');
125
+ if (pageName) {
126
+ const pageElement = document.getElementById('page-' + pageName);
127
+ if (pageElement) {
128
+ pageElement.click();
129
+ }
130
+ }
131
131
  })
132
132
  .catch(err => {
133
133
  element.innerText = err;
@@ -135,29 +135,6 @@
135
135
  })
136
136
  .catch(function(error) {
137
137
  console.log(error);
138
- if (md) {
139
- showdowns
140
- .makeHtml(md, csstypes => {
141
- mdCssTypes = csstypes;
142
- })
143
- .then(res => {
144
- if (typeof res === 'object') {
145
- if (typeof res.html === 'string') {
146
- element.innerHTML = res.html;
147
- } else {
148
- res.html.forEach((e)=>{
149
- element.appendChild(e);
150
- });
151
- }
152
- showdowns.completedHtml(res.scripts, '.showdowns');
153
- } else {
154
- element.innerHTML = res;
155
- }
156
- })
157
- .catch(err => {
158
- element.innerText = err;
159
- });
160
- }
161
138
  });
162
139
  })(document.getElementById("main"));
163
140
  </script>