@cobapen/markdown 0.8.0 → 0.8.2

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/lib/index.d.ts CHANGED
@@ -4,7 +4,7 @@ import { RewriteHandler } from "./plugins/rewritelink.js";
4
4
  export interface Config {
5
5
  showCodeTitleByDefault: boolean;
6
6
  rewriteLink?: RewriteHandler;
7
- tocLevel: number | [number, number];
7
+ tocLevel: number | number[];
8
8
  markdown: Partial<MarkdownOptions>;
9
9
  math: Partial<MathOptions>;
10
10
  }
package/lib/index.js CHANGED
@@ -9,6 +9,7 @@ import { cjk_break } from "./plugins/cjk-break.js";
9
9
  import { fence_custom } from "./plugins/code/fence-custom.js";
10
10
  import { highlighterForMarkdownIt } from "./plugins/code/highlight.js";
11
11
  import { mdmath } from "./plugins/math/mdmath.js";
12
+ import { mermaidPlugin } from "./plugins/mermaid.js";
12
13
  import { rewritelink } from "./plugins/rewritelink.js";
13
14
  await MathJaxEngine.loadExtensions();
14
15
  const defaultOptions = {
@@ -54,8 +55,9 @@ export class CMarkdown {
54
55
  })
55
56
  .use(advTable)
56
57
  .use(mdmath(this._mj))
58
+ .use(mermaidPlugin)
57
59
  .use(toc, {
58
- markderPattern: /^\[\[(toc|_toc_)\]\]/im,
60
+ markerPattern: /^\[\[(toc|_toc_)\]\]/im,
59
61
  includeLevel: fmtTocLevel(this._config.tocLevel),
60
62
  });
61
63
  }
@@ -69,7 +71,8 @@ export class CMarkdown {
69
71
  }
70
72
  function fmtTocLevel(level) {
71
73
  if (typeof level === "number") {
72
- return [2, Math.max(2, level)];
74
+ const length = Math.max(2, level) - 1;
75
+ return Array.from({ length }, (_, i) => i + 2);
73
76
  }
74
77
  else {
75
78
  return level;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cobapen/markdown",
3
- "version": "0.8.0",
3
+ "version": "0.8.2",
4
4
  "description": "A markdown converter for cobapen website",
5
5
  "keywords": [
6
6
  "markdown"