@brillout/docpress 0.3.1 → 0.3.3
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/dist/{chunk-Q2ERR2XO.js → chunk-MWMYEK3D.js} +1 -1
- package/dist/{chunk-LOKHCWMR.js → chunk-REPAOCCC.js} +23 -4
- package/dist/{chunk-6E4FPH4J.js → chunk-YNTER77S.js} +1 -1
- package/dist/cli/index.js +3 -3
- package/dist/{devServer-4RTCJ64B.js → devServer-MLU3NNYM.js} +2 -2
- package/dist/index.js +2 -2
- package/dist/renderer/_default.page.server.js +2 -2
- package/package.json +3 -2
|
@@ -15,7 +15,7 @@ function filter(obj, predicate) {
|
|
|
15
15
|
|
|
16
16
|
// src/utils/determineSectionUrlHash.ts
|
|
17
17
|
function determineSectionUrlHash(title) {
|
|
18
|
-
const urlHash = title.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "").split(/[^a-z0-9]+/).filter(Boolean).join("-");
|
|
18
|
+
const urlHash = title.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "").split(/[^a-z0-9\u4E00-\u9FA5]+/).filter(Boolean).join("-");
|
|
19
19
|
if (urlHash === "")
|
|
20
20
|
return null;
|
|
21
21
|
return urlHash;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
determineSectionUrlHash
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-MWMYEK3D.js";
|
|
4
4
|
import {
|
|
5
5
|
assert
|
|
6
6
|
} from "./chunk-2ZTPUQGS.js";
|
|
@@ -11,6 +11,7 @@ import react from "@vitejs/plugin-react-swc";
|
|
|
11
11
|
import ssr from "vite-plugin-ssr/plugin";
|
|
12
12
|
|
|
13
13
|
// src/markdownHeadingsVitePlugin.ts
|
|
14
|
+
import os from "os";
|
|
14
15
|
function markdownHeadingsVitePlugin() {
|
|
15
16
|
return {
|
|
16
17
|
name: "mdx-headings",
|
|
@@ -50,14 +51,26 @@ ${headingsExportCode}
|
|
|
50
51
|
return codeNew;
|
|
51
52
|
}
|
|
52
53
|
function parseMarkdownHeading(line) {
|
|
54
|
+
var _a;
|
|
53
55
|
const [lineBegin, ...lineWords] = line.split(" ");
|
|
54
56
|
assert(lineBegin.split("#").join("") === "", { line, lineWords });
|
|
55
57
|
const headingLevel = lineBegin.length;
|
|
56
58
|
const titleMdx = lineWords.join(" ");
|
|
57
59
|
assert(!titleMdx.startsWith(" "), { line, lineWords });
|
|
58
60
|
assert(titleMdx, { line, lineWords });
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
+
const headingMdx = {
|
|
62
|
+
title: titleMdx,
|
|
63
|
+
anchor: titleMdx
|
|
64
|
+
};
|
|
65
|
+
{
|
|
66
|
+
const customAnchor = (_a = /(?<={#).*(?=})/g.exec(titleMdx)) == null ? void 0 : _a[0];
|
|
67
|
+
if (customAnchor) {
|
|
68
|
+
headingMdx.anchor = customAnchor;
|
|
69
|
+
headingMdx.title = titleMdx.replace(/{#.*}/g, "");
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
const headingId = determineSectionUrlHash(headingMdx.anchor);
|
|
73
|
+
const title = headingMdx.title;
|
|
61
74
|
const titleParsed = parseTitle(title);
|
|
62
75
|
assert(headingId === null || headingId.length > 0);
|
|
63
76
|
const headingAttrId = headingId === null ? "" : ` id="${headingId}"`;
|
|
@@ -99,10 +112,16 @@ function parseTitle(titleMarkdown) {
|
|
|
99
112
|
}).join("");
|
|
100
113
|
return titleHtml;
|
|
101
114
|
function serializeText(text) {
|
|
102
|
-
|
|
115
|
+
let textEscaped = text.split("'").join("\\'");
|
|
116
|
+
if (isWindows()) {
|
|
117
|
+
textEscaped = textEscaped.replace(/\r/, "");
|
|
118
|
+
}
|
|
103
119
|
return `{'${textEscaped}'}`;
|
|
104
120
|
}
|
|
105
121
|
}
|
|
122
|
+
function isWindows() {
|
|
123
|
+
return os.platform() === "win32";
|
|
124
|
+
}
|
|
106
125
|
|
|
107
126
|
// src/vite.config.ts
|
|
108
127
|
import rehypePrettyCode from "rehype-pretty-code";
|
package/dist/cli/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
vite_config_default
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-REPAOCCC.js";
|
|
4
|
+
import "../chunk-MWMYEK3D.js";
|
|
5
5
|
import "../chunk-2ZTPUQGS.js";
|
|
6
6
|
import "../chunk-3QC7HYIF.js";
|
|
7
7
|
|
|
@@ -16,7 +16,7 @@ Error.stackTraceLimit = Infinity;
|
|
|
16
16
|
cli();
|
|
17
17
|
async function cli() {
|
|
18
18
|
if (isDev) {
|
|
19
|
-
await import("../devServer-
|
|
19
|
+
await import("../devServer-MLU3NNYM.js");
|
|
20
20
|
} else if (isBuild) {
|
|
21
21
|
await build(vite_config_default);
|
|
22
22
|
await build({ ...vite_config_default, build: { ssr: true } });
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
isRepoLink,
|
|
5
5
|
parseTitle,
|
|
6
6
|
usePageContext
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-YNTER77S.js";
|
|
8
8
|
import {
|
|
9
9
|
FeatureList
|
|
10
10
|
} from "./chunk-NVJING6T.js";
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
filter,
|
|
17
17
|
jsxToTextContent,
|
|
18
18
|
objectAssign
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-MWMYEK3D.js";
|
|
20
20
|
import {
|
|
21
21
|
assert,
|
|
22
22
|
assertUsage,
|
|
@@ -4,12 +4,12 @@ import {
|
|
|
4
4
|
getHeadings,
|
|
5
5
|
parseTitle,
|
|
6
6
|
usePageContext
|
|
7
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-YNTER77S.js";
|
|
8
8
|
import {
|
|
9
9
|
Emoji,
|
|
10
10
|
jsxToTextContent,
|
|
11
11
|
objectAssign
|
|
12
|
-
} from "../chunk-
|
|
12
|
+
} from "../chunk-MWMYEK3D.js";
|
|
13
13
|
import {
|
|
14
14
|
assert,
|
|
15
15
|
assertUsage,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brillout/docpress",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"exports": {
|
|
5
5
|
"./renderer/_default.page.server.js": "./dist/renderer/_default.page.server.js",
|
|
6
6
|
"./renderer/_default.page.client.js": "./dist/renderer/_default.page.client.js",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"dev": "docpress dev",
|
|
34
34
|
"preview": "docpress build && docpress preview",
|
|
35
35
|
"// Build Docpress": "",
|
|
36
|
-
"build": "
|
|
36
|
+
"build": "rimraf dist/ && framework-builder",
|
|
37
37
|
"// Release": "",
|
|
38
38
|
"release": "release-me patch"
|
|
39
39
|
},
|
|
@@ -66,6 +66,7 @@
|
|
|
66
66
|
"docpress": "link:",
|
|
67
67
|
"react": "^18.1.0",
|
|
68
68
|
"react-dom": "^18.1.0",
|
|
69
|
+
"rimraf": "^3.0.2",
|
|
69
70
|
"rollup": "^2.74.1",
|
|
70
71
|
"tsx": "^3.12.1",
|
|
71
72
|
"typescript": "^4.9.4"
|