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 +5 -3
- package/dist/index.mjs +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
[](https://github.com/Virgil-N/pretty-toc/actions/workflows/codeql.yml)
|
|
2
2
|
[](https://github.com/Virgil-N/pretty-toc/actions/workflows/coverage.yml)
|
|
3
3
|
[](https://github.com/Virgil-N/pretty-toc/actions/workflows/verify-and-release.yml)
|
|
4
|
+

|
|
4
5
|

|
|
6
|
+

|
|
7
|
+

|
|
5
8
|

|
|
6
9
|

|
|
7
|
-

|
|
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
|
-
|
|
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
|
|
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) +
|
|
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
|
<body>
|
|
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("\"", "'")
|
|
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,
|