docula 0.9.4 → 0.9.6
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/docula.js +15 -17
- package/package.json +12 -13
- package/template/css/base.css +2 -0
package/dist/docula.js
CHANGED
|
@@ -213,7 +213,7 @@ var DoculaConsole = class {
|
|
|
213
213
|
// src/builder.ts
|
|
214
214
|
import fs from "node:fs";
|
|
215
215
|
import { Ecto } from "ecto";
|
|
216
|
-
import
|
|
216
|
+
import { Writr } from "writr";
|
|
217
217
|
import he from "he";
|
|
218
218
|
import * as cheerio from "cheerio";
|
|
219
219
|
|
|
@@ -618,8 +618,9 @@ var DoculaBuilder = class {
|
|
|
618
618
|
}
|
|
619
619
|
parseDocumentData(documentPath) {
|
|
620
620
|
const documentContent = fs.readFileSync(documentPath, "utf8");
|
|
621
|
-
const
|
|
622
|
-
|
|
621
|
+
const writr = new Writr(documentContent);
|
|
622
|
+
const matterData = writr.frontMatter;
|
|
623
|
+
let markdownContent = writr.body;
|
|
623
624
|
markdownContent = markdownContent.replace(/^# .*\n/, "");
|
|
624
625
|
const documentsFolderIndex = documentPath.lastIndexOf("/docs/");
|
|
625
626
|
let urlPath = documentPath.slice(documentsFolderIndex).replace(".md", "/index.html");
|
|
@@ -633,17 +634,17 @@ var DoculaBuilder = class {
|
|
|
633
634
|
}
|
|
634
635
|
return {
|
|
635
636
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
636
|
-
title: matterData.
|
|
637
|
+
title: matterData.title,
|
|
637
638
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
638
|
-
navTitle: matterData.
|
|
639
|
+
navTitle: matterData.navTitle || matterData.title,
|
|
639
640
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
640
|
-
description: matterData.
|
|
641
|
+
description: matterData.description || "",
|
|
641
642
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
642
|
-
order: matterData.
|
|
643
|
+
order: matterData.order || void 0,
|
|
643
644
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
644
|
-
section: matterData.
|
|
645
|
+
section: matterData.section || void 0,
|
|
645
646
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
646
|
-
keywords: matterData.
|
|
647
|
+
keywords: matterData.keywords || [],
|
|
647
648
|
content: documentContent,
|
|
648
649
|
markdown: markdownContent,
|
|
649
650
|
generatedHtml: this._ecto.renderSync(markdownContent, void 0, "markdown"),
|
|
@@ -653,9 +654,6 @@ var DoculaBuilder = class {
|
|
|
653
654
|
isRoot
|
|
654
655
|
};
|
|
655
656
|
}
|
|
656
|
-
removeFrontmatter(markdown) {
|
|
657
|
-
return markdown.replace(/^-{3}[\s\S]*?-{3}\s*/, "");
|
|
658
|
-
}
|
|
659
657
|
getTableOfContents(markdown) {
|
|
660
658
|
markdown = `## Table of Contents
|
|
661
659
|
|
|
@@ -691,7 +689,7 @@ ${markdown}`;
|
|
|
691
689
|
|
|
692
690
|
// src/helpers.ts
|
|
693
691
|
import fs2 from "node:fs";
|
|
694
|
-
import { Writr } from "writr";
|
|
692
|
+
import { Writr as Writr2 } from "writr";
|
|
695
693
|
var DoculaHelpers = class {
|
|
696
694
|
createDoc(path4, destination, frontMatter, contentFunction) {
|
|
697
695
|
const content = fs2.readFileSync(path4, "utf8");
|
|
@@ -702,16 +700,16 @@ var DoculaHelpers = class {
|
|
|
702
700
|
fs2.writeFileSync(destination, newContent, "utf8");
|
|
703
701
|
}
|
|
704
702
|
getFrontMatterFromFile(path4) {
|
|
705
|
-
const writr = new
|
|
703
|
+
const writr = new Writr2();
|
|
706
704
|
writr.loadFromFileSync(path4);
|
|
707
705
|
return writr.frontMatter;
|
|
708
706
|
}
|
|
709
707
|
getFrontMatter(content) {
|
|
710
|
-
const writr = new
|
|
708
|
+
const writr = new Writr2(content);
|
|
711
709
|
return writr.frontMatter;
|
|
712
710
|
}
|
|
713
711
|
setFrontMatterToFile(path4, frontMatter) {
|
|
714
|
-
const writr = new
|
|
712
|
+
const writr = new Writr2();
|
|
715
713
|
writr.loadFromFileSync(path4);
|
|
716
714
|
writr.frontMatter = frontMatter;
|
|
717
715
|
fs2.writeFileSync(path4, writr.content, "utf8");
|
|
@@ -720,7 +718,7 @@ var DoculaHelpers = class {
|
|
|
720
718
|
if (!frontMatter) {
|
|
721
719
|
return content;
|
|
722
720
|
}
|
|
723
|
-
const writr = new
|
|
721
|
+
const writr = new Writr2(content);
|
|
724
722
|
writr.frontMatter = frontMatter;
|
|
725
723
|
return writr.content;
|
|
726
724
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "docula",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.6",
|
|
4
4
|
"description": "Beautiful Website for Your Projects",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/docula.js",
|
|
@@ -46,29 +46,28 @@
|
|
|
46
46
|
"docula": "./bin/docula.mjs"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"axios": "^1.7.
|
|
49
|
+
"axios": "^1.7.9",
|
|
50
50
|
"cheerio": "^1.0.0",
|
|
51
|
-
"ecto": "^4.1.
|
|
52
|
-
"express": "^4.21.
|
|
51
|
+
"ecto": "^4.1.4",
|
|
52
|
+
"express": "^4.21.2",
|
|
53
53
|
"feed": "^4.2.2",
|
|
54
|
-
"gray-matter": "^4.0.3",
|
|
55
54
|
"he": "^1.2.0",
|
|
56
55
|
"update-notifier": "^7.3.1",
|
|
57
|
-
"writr": "^4.
|
|
56
|
+
"writr": "^4.2.0"
|
|
58
57
|
},
|
|
59
58
|
"devDependencies": {
|
|
60
59
|
"@types/express": "^5.0.0",
|
|
61
60
|
"@types/he": "^1.2.3",
|
|
62
61
|
"@types/js-yaml": "^4.0.9",
|
|
63
|
-
"@types/node": "^22.
|
|
62
|
+
"@types/node": "^22.10.2",
|
|
64
63
|
"@types/update-notifier": "^6.0.8",
|
|
65
|
-
"@vitest/coverage-v8": "^2.1.
|
|
64
|
+
"@vitest/coverage-v8": "^2.1.8",
|
|
66
65
|
"rimraf": "^6.0.1",
|
|
67
|
-
"tsup": "^8.3.
|
|
68
|
-
"typescript": "^5.
|
|
69
|
-
"vitest": "^2.1.
|
|
70
|
-
"webpack": "^5.
|
|
71
|
-
"xo": "^0.
|
|
66
|
+
"tsup": "^8.3.5",
|
|
67
|
+
"typescript": "^5.7.2",
|
|
68
|
+
"vitest": "^2.1.8",
|
|
69
|
+
"webpack": "^5.97.1",
|
|
70
|
+
"xo": "^0.60.0"
|
|
72
71
|
},
|
|
73
72
|
"xo": {
|
|
74
73
|
"ignores": [
|