pretty-toc 1.3.6 → 1.3.8

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
@@ -1,10 +1,12 @@
1
1
  [![CodeQL Advanced](https://github.com/Virgil-N/pretty-toc/actions/workflows/codeql.yml/badge.svg)](https://github.com/Virgil-N/pretty-toc/actions/workflows/codeql.yml)
2
2
  [![Coverage](https://github.com/Virgil-N/pretty-toc/actions/workflows/coverage.yml/badge.svg)](https://github.com/Virgil-N/pretty-toc/actions/workflows/coverage.yml)
3
3
  [![Verify and Release](https://github.com/Virgil-N/pretty-toc/actions/workflows/verify-and-release.yml/badge.svg)](https://github.com/Virgil-N/pretty-toc/actions/workflows/verify-and-release.yml)
4
+ ![GitHub License](https://img.shields.io/github/license/Virgil-N/pretty-toc)
4
5
  ![GitHub repo size](https://img.shields.io/github/repo-size/Virgil-N/pretty-toc)
6
+ ![NPM Unpacked Size](https://img.shields.io/npm/unpacked-size/pretty-toc)
7
+ ![NPM Version](https://img.shields.io/npm/v/pretty-toc)
5
8
  ![NPM Downloads](https://img.shields.io/npm/dm/pretty-toc)
6
9
  ![NPM Downloads](https://img.shields.io/npm/d18m/pretty-toc)
7
- ![GitHub License](https://img.shields.io/github/license/Virgil-N/pretty-toc)
8
10
 
9
11
  A Table of Contents generation plugin for the Satteri markdown parser library.
10
12
 
@@ -45,7 +47,7 @@ satteri({
45
47
  })
46
48
 
47
49
  // Full example
48
- processor: satteri({
50
+ satteri({
49
51
  hastPlugins: [
50
52
  prettyToc({
51
53
  title: "Table of Contents",
@@ -107,7 +109,7 @@ processor: satteri({
107
109
  ## Screenshots
108
110
 
109
111
  <details>
110
- <summary>点击展开</summary>
112
+ <summary>Click to open</summary>
111
113
  <ol>
112
114
  <li>
113
115
  <p>icon</p>
package/dist/index.mjs CHANGED
@@ -88,7 +88,7 @@ function prettyToc(option) {
88
88
  try {
89
89
  const depth = parseInt(node.tagName.slice(-1), 10);
90
90
  const content = ctx.textContent(node);
91
- const contentSlug = slug(content) + (/* @__PURE__ */ new Date()).getTime();
91
+ const contentSlug = slug(content) + "-" + crypto.randomUUID();
92
92
  if (opt.languageMap) title = opt.languageMap[opt.locale ?? "en-US"] || "Table of Contents";
93
93
  else title = DEFAULT_LANGUAGE_MAP[opt.locale ?? "en-US"] || "Table of Contents";
94
94
  if (opt.listStyle === "icon" || opt.listStyle === "image" || opt.listStyle === "decimal") listStyle = "none";
@@ -320,7 +320,7 @@ function prettyToc(option) {
320
320
  &lt;body&gt;
321
321
  <script is:inline data-astro-rerun>
322
322
  const currentLocale = window.parent.location.pathname.split('/')[1] || '${opt.locale || "en-US"}';
323
- const languageMap = ${JSON.stringify(opt.languageMap).replaceAll("\"", "'")} || ${JSON.stringify(DEFAULT_LANGUAGE_MAP).replaceAll("\"", "'")};
323
+ const languageMap = ${opt.languageMap ? JSON.stringify(opt.languageMap).replaceAll("\"", "'") : JSON.stringify(DEFAULT_LANGUAGE_MAP).replaceAll("\"", "'")};
324
324
 
325
325
  function syncTocTitle(
326
326
  locale,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pretty-toc",
3
- "version": "1.3.6",
3
+ "version": "1.3.8",
4
4
  "type": "module",
5
5
  "description": "A Table of Contents generation plugin for the Satteri markdown parser library.",
6
6
  "keywords": [