@tnotesjs/core 0.6.1 → 0.7.0
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/config/templates.ts +0 -5
- package/dist/{chunk-5F5RJ2HV.cjs → chunk-7FEANCT6.cjs} +16 -7
- package/dist/chunk-AGVER5MX.cjs +1746 -0
- package/dist/{chunk-TJ4527KA.cjs → chunk-BL22KD4V.cjs} +324 -950
- package/dist/{chunk-56PKXCOX.js → chunk-GWG75A5M.js} +13 -4
- package/dist/{chunk-DUTS75WQ.js → chunk-XNO3PCEH.js} +374 -1000
- package/dist/chunk-ZEQS64PE.js +1746 -0
- package/dist/cli/index.cjs +76 -155
- package/dist/cli/index.js +10 -89
- package/dist/markdown/index.cjs +2 -3
- package/dist/markdown/index.d.cts +1 -1
- package/dist/markdown/index.d.ts +1 -1
- package/dist/markdown/index.js +1 -2
- package/dist/{types-CwBWwNVv.d.ts → types-C_d0fFeD.d.ts} +8 -1
- package/dist/{types-CpsEy8lA.d.cts → types-MRBGgJTX.d.cts} +8 -1
- package/dist/vitepress/config/index.cjs +200 -132
- package/dist/vitepress/config/index.js +187 -119
- package/dist/workspace/index.cjs +4 -1202
- package/dist/workspace/index.d.cts +2 -2
- package/dist/workspace/index.d.ts +2 -2
- package/dist/workspace/index.js +4 -1202
- package/package.json +1 -1
- package/services/file-watcher/folderChangeHandler.ts +19 -15
- package/services/file-watcher/globalUpdateCoordinator.ts +21 -27
- package/services/file-watcher/service.ts +1 -6
- package/services/index.ts +0 -1
- package/services/note/service.ts +4 -6
- package/services/readme/service.ts +11 -18
- package/services/reconcileToc.ts +20 -0
- package/utils/index.ts +0 -9
- package/{services/toc → utils}/moveTocInside.test.ts +1 -1
- package/vitepress/components/constants.ts +2 -2
- package/vitepress/components/sidebar.data.ts +8 -5
- package/vitepress/plugins/sidebarStructurePlugin.ts +242 -145
- package/dist/chunk-3R7QSABB.cjs +0 -502
- package/dist/chunk-CZXRQPFJ.js +0 -11
- package/dist/chunk-HXED7KVT.cjs +0 -11
- package/dist/chunk-U6IBLREL.js +0 -502
- package/services/toc/index.ts +0 -5
- package/services/toc/service.ts +0 -759
- package/utils/migrateReadmeToToc.test.ts +0 -111
- package/utils/migrateReadmeToToc.ts +0 -135
package/config/templates.ts
CHANGED
|
@@ -1,11 +1,19 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
-
|
|
3
|
-
var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }// utils/generateAnchor.ts
|
|
2
|
+
var _githubslugger = require('github-slugger'); var _githubslugger2 = _interopRequireDefault(_githubslugger);
|
|
3
|
+
var slugger = new (0, _githubslugger2.default)();
|
|
4
|
+
var generateAnchor = (label) => {
|
|
5
|
+
slugger.reset();
|
|
6
|
+
return slugger.slug(label);
|
|
7
|
+
};
|
|
4
8
|
|
|
5
9
|
// markdown/noteFormatter.ts
|
|
6
|
-
var _prettier = require('prettier');
|
|
7
10
|
var NOTE_TOC_START_TAG = "<!-- region:toc -->";
|
|
8
11
|
var NOTE_TOC_END_TAG = "<!-- endregion:toc -->";
|
|
12
|
+
async function prettierFormat(content, options) {
|
|
13
|
+
const module = await Promise.resolve().then(() => _interopRequireWildcard(require("prettier")));
|
|
14
|
+
const prettier = _nullishCoalesce(module.default, () => ( module));
|
|
15
|
+
return prettier.format(content, options);
|
|
16
|
+
}
|
|
9
17
|
function generatedNoteTitle(input) {
|
|
10
18
|
const dirName = `${input.noteIndex}. ${input.title}`;
|
|
11
19
|
const encodedDirName = encodeURIComponent(dirName);
|
|
@@ -96,7 +104,7 @@ function normalizeHeadings(lines) {
|
|
|
96
104
|
function buildHeadingToc(headings) {
|
|
97
105
|
return headings.map((heading) => {
|
|
98
106
|
const indent = " ".repeat(Math.max(0, heading.level - 2) * 2);
|
|
99
|
-
return `${indent}- [${heading.text}](#${
|
|
107
|
+
return `${indent}- [${heading.text}](#${generateAnchor(heading.text)})`;
|
|
100
108
|
});
|
|
101
109
|
}
|
|
102
110
|
function stringArray(value) {
|
|
@@ -139,7 +147,7 @@ function buildResourceToc(input) {
|
|
|
139
147
|
async function formatTNotesNote(input) {
|
|
140
148
|
let content = input.content.replace(/\r\n?/g, "\n");
|
|
141
149
|
if (input.prettier !== false) {
|
|
142
|
-
content = await
|
|
150
|
+
content = await prettierFormat(content, {
|
|
143
151
|
parser: "markdown",
|
|
144
152
|
proseWrap: "never",
|
|
145
153
|
endOfLine: "lf"
|
|
@@ -173,4 +181,5 @@ async function formatTNotesNote(input) {
|
|
|
173
181
|
|
|
174
182
|
|
|
175
183
|
|
|
176
|
-
|
|
184
|
+
|
|
185
|
+
exports.generateAnchor = generateAnchor; exports.NOTE_TOC_START_TAG = NOTE_TOC_START_TAG; exports.NOTE_TOC_END_TAG = NOTE_TOC_END_TAG; exports.formatTNotesNote = formatTNotesNote;
|