@ubean/content 0.4.8 → 0.4.10
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/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as generateId, a as getCollection, b as parseMarkdown, c as parseContentFile, d as registerContent, f as scanContentSources, g as defineContentCollection, h as createQueryBuilder, i as fetchContentNavigation, l as queryCollection, m as createContentCollection, n as configureContentRuntime, o as getContentItem, p as buildNavigation, r as defineCollection, s as listCollections, t as bootstrapContentFromDisk, u as queryCollectionSearchSections, v as parseContent, y as parseFrontmatter } from "./runtime-
|
|
1
|
+
import { _ as generateId, a as getCollection, b as parseMarkdown, c as parseContentFile, d as registerContent, f as scanContentSources, g as defineContentCollection, h as createQueryBuilder, i as fetchContentNavigation, l as queryCollection, m as createContentCollection, n as configureContentRuntime, o as getContentItem, p as buildNavigation, r as defineCollection, s as listCollections, t as bootstrapContentFromDisk, u as queryCollectionSearchSections, v as parseContent, y as parseFrontmatter } from "./runtime-DPsviqaI.js";
|
|
2
2
|
import { a as runPagefindIndex, c as tokenizeText, i as resolveContentSearchConfig, n as generateSearchSections, o as searchSections, r as generateSearchSectionsSnapshot, s as splitDocumentIntoSearchSections, t as createSectionSearch } from "./search-C73D12td.js";
|
|
3
3
|
import ubeanContentPlugin from "./vite.js";
|
|
4
4
|
//#region src/routing.ts
|
|
@@ -89,6 +89,8 @@ function parseMarkdown(content) {
|
|
|
89
89
|
let foundExcerptSeparator = false;
|
|
90
90
|
let headingStack = [toc];
|
|
91
91
|
let headingDepths = [0];
|
|
92
|
+
/** 标题文本 → 已出现次数;重复标题追加 `-n` 后缀,保证锚点/搜索 section id 唯一 */
|
|
93
|
+
const headingIdCounts = /* @__PURE__ */ new Map();
|
|
92
94
|
for (let i = 0; i < lines.length; i++) {
|
|
93
95
|
const line = lines[i];
|
|
94
96
|
if (line.startsWith("```")) {
|
|
@@ -130,7 +132,10 @@ function parseMarkdown(content) {
|
|
|
130
132
|
flushParagraph();
|
|
131
133
|
const depth = headingMatch[1].length;
|
|
132
134
|
const text = headingMatch[2].replace(/[#*_`~[\]]/g, "").trim();
|
|
133
|
-
const
|
|
135
|
+
const baseId = kebabCase(text.replace(/\s+/g, "-"));
|
|
136
|
+
const idCount = headingIdCounts.get(baseId) ?? 0;
|
|
137
|
+
headingIdCounts.set(baseId, idCount + 1);
|
|
138
|
+
const id = idCount === 0 ? baseId : `${baseId}-${idCount}`;
|
|
134
139
|
while (headingDepths[headingDepths.length - 1] >= depth) {
|
|
135
140
|
headingDepths.pop();
|
|
136
141
|
headingStack.pop();
|
package/dist/runtime.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as generateId, a as getCollection, b as parseMarkdown, c as parseContentFile, d as registerContent, g as defineContentCollection, h as createQueryBuilder, i as fetchContentNavigation, l as queryCollection, m as createContentCollection, n as configureContentRuntime, o as getContentItem, p as buildNavigation, r as defineCollection, s as listCollections, t as bootstrapContentFromDisk, u as queryCollectionSearchSections, v as parseContent, y as parseFrontmatter } from "./runtime-
|
|
1
|
+
import { _ as generateId, a as getCollection, b as parseMarkdown, c as parseContentFile, d as registerContent, g as defineContentCollection, h as createQueryBuilder, i as fetchContentNavigation, l as queryCollection, m as createContentCollection, n as configureContentRuntime, o as getContentItem, p as buildNavigation, r as defineCollection, s as listCollections, t as bootstrapContentFromDisk, u as queryCollectionSearchSections, v as parseContent, y as parseFrontmatter } from "./runtime-DPsviqaI.js";
|
|
2
2
|
export { bootstrapContentFromDisk, buildNavigation, configureContentRuntime, createContentCollection, createQueryBuilder, defineCollection, defineContentCollection, fetchContentNavigation, generateId, getCollection, getContentItem, listCollections, parseContent, parseContentFile, parseFrontmatter, parseMarkdown, queryCollection, queryCollectionSearchSections, registerContent };
|
package/dist/vite.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as registerContent, f as scanContentSources, n as configureContentRuntime } from "./runtime-
|
|
1
|
+
import { d as registerContent, f as scanContentSources, n as configureContentRuntime } from "./runtime-DPsviqaI.js";
|
|
2
2
|
import { r as generateSearchSectionsSnapshot } from "./search-C73D12td.js";
|
|
3
3
|
import { defu } from "defu";
|
|
4
4
|
import { join } from "pathe";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ubean/content",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.10",
|
|
4
4
|
"description": "File-based content module for ubean (markdown/MDX/YAML/JSON)",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
}
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@ubean/shared": "0.4.
|
|
31
|
+
"@ubean/shared": "0.4.10",
|
|
32
32
|
"defu": "6.1.7",
|
|
33
33
|
"pathe": "^2.0.3",
|
|
34
34
|
"scule": "^1.3.0"
|