@tnotesjs/core 0.4.2 → 0.6.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.
Files changed (48) hide show
  1. package/dist/chunk-3R7QSABB.cjs +502 -0
  2. package/dist/chunk-CZXRQPFJ.js +11 -0
  3. package/dist/{chunk-XCWFZLER.js → chunk-DUTS75WQ.js} +27 -493
  4. package/dist/chunk-HXED7KVT.cjs +11 -0
  5. package/dist/chunk-IHFUHB4J.cjs +176 -0
  6. package/dist/chunk-MZIXIY2Y.cjs +216 -0
  7. package/dist/chunk-TJ4527KA.cjs +5264 -0
  8. package/dist/chunk-U6IBLREL.js +502 -0
  9. package/dist/chunk-UNFSW5C2.js +176 -0
  10. package/dist/cli/index.cjs +936 -0
  11. package/dist/cli/index.d.cts +2 -0
  12. package/dist/cli/index.d.ts +2 -0
  13. package/dist/cli/index.js +9 -6
  14. package/dist/index.cjs +8 -0
  15. package/dist/index.d.cts +56 -0
  16. package/dist/index.d.ts +56 -0
  17. package/dist/markdown/index.cjs +82 -0
  18. package/dist/markdown/index.d.cts +36 -0
  19. package/dist/markdown/index.d.ts +36 -0
  20. package/dist/markdown/index.js +82 -0
  21. package/dist/note-oGm44Rw8.d.cts +84 -0
  22. package/dist/note-oGm44Rw8.d.ts +84 -0
  23. package/dist/types-CpsEy8lA.d.cts +221 -0
  24. package/dist/types-CwBWwNVv.d.ts +221 -0
  25. package/dist/vitepress/config/index.cjs +1669 -0
  26. package/dist/vitepress/config/index.d.cts +12 -0
  27. package/dist/vitepress/config/index.d.ts +12 -0
  28. package/dist/vitepress/config/index.js +26 -192
  29. package/dist/workspace/index.cjs +1207 -0
  30. package/dist/workspace/index.d.cts +14 -0
  31. package/dist/workspace/index.d.ts +14 -0
  32. package/dist/workspace/index.js +1207 -0
  33. package/package.json +16 -3
  34. package/vitepress/components/MindmapPreview/MindmapPreview.vue +189 -34
  35. package/vitepress/components/MindmapPreview/MindmapViewIcon.vue +41 -0
  36. package/vitepress/components/MindmapPreview/markdown.test.ts +67 -0
  37. package/vitepress/components/MindmapPreview/markdown.ts +83 -0
  38. package/vitepress/components/MindmapPreview/wheelInteraction.test.ts +23 -0
  39. package/vitepress/components/MindmapPreview/wheelInteraction.ts +7 -0
  40. package/vitepress/components/Settings/Settings.vue +3 -3
  41. package/vitepress/components/SidebarCard/SidebarCard.vue +3 -3
  42. package/vitepress/components/constants.ts +0 -5
  43. package/vitepress/configs/markdown.config.ts +6 -199
  44. package/vitepress/plugins/localSearchReindexLogic.ts +11 -3
  45. package/vitepress/theme/index.ts +0 -2
  46. package/vitepress/components/MindmapPreview/compat.test.ts +0 -93
  47. package/vitepress/components/MindmapPreview/compat.ts +0 -128
  48. package/vitepress/components/MindmapPreview/legacyCorpus.test.ts +0 -57
@@ -3,6 +3,33 @@ import {
3
3
  getConfigManager,
4
4
  getDefaultConfig
5
5
  } from "./chunk-UJG3UU5X.js";
6
+ import {
7
+ TOC_INDENT_SPACES,
8
+ adjustTocLineIndexAfterSubtreeRemoval,
9
+ buildFolderTocLine,
10
+ buildSidebarFromTocTree,
11
+ buildTocLine,
12
+ collectNoteIndexesInSubtree,
13
+ findFolderLineIndex,
14
+ findTocLineIndex,
15
+ generateNoteTitle,
16
+ getNewNoteReadmeBody,
17
+ getPreviousNoteIndexOutsideSubtree,
18
+ getPreviousTocNoteIndex,
19
+ getTocEntrySubtreeRange,
20
+ getTocLineCompleted,
21
+ isNoteIndexInSubtree,
22
+ parseNodeId,
23
+ parseTocLine,
24
+ parseTocToTree,
25
+ processTocEmptyLines,
26
+ renameFolderLine,
27
+ resolveNoteFromIndex,
28
+ serializeTocTree
29
+ } from "./chunk-U6IBLREL.js";
30
+ import {
31
+ generateAnchor
32
+ } from "./chunk-CZXRQPFJ.js";
6
33
 
7
34
  // utils/errorHandler.ts
8
35
  var TNotesError = class _TNotesError extends Error {
@@ -322,14 +349,6 @@ async function ensureDirectory(dir) {
322
349
  }
323
350
  }
324
351
 
325
- // utils/generateAnchor.ts
326
- import GithubSlugger from "github-slugger";
327
- var slugger = new GithubSlugger();
328
- var generateAnchor = (label) => {
329
- slugger.reset();
330
- return slugger.slug(label);
331
- };
332
-
333
352
  // utils/genHierarchicalSidebar.ts
334
353
  var genHierarchicalSidebar = (itemList, titles, titlesNotesCount, sidebarIsCollapsed) => {
335
354
  const stack = [];
@@ -457,457 +476,6 @@ function parseReadmeCompletedNotes(content) {
457
476
  };
458
477
  }
459
478
 
460
- // utils/tocNodeId.ts
461
- function extractNoteIndexFromLink(link) {
462
- if (!link) return null;
463
- const match = link.match(/\/notes\/(\d{4})\./);
464
- return match ? match[1] : null;
465
- }
466
- function nodeIdForNote(noteIndex) {
467
- return `note:${noteIndex}`;
468
- }
469
- function nodeIdForFolder(folderPath) {
470
- return `folder:${folderPath.join("/")}`;
471
- }
472
- function nodeIdForLine(tocLineIndex) {
473
- return `line:${tocLineIndex}`;
474
- }
475
- function computeSidebarNodeId(item) {
476
- if (item.nodeId) return item.nodeId;
477
- const noteIndex = extractNoteIndexFromLink(item.link);
478
- if (noteIndex) return nodeIdForNote(noteIndex);
479
- if (item.tocLineIndex !== void 0 && !item.link) {
480
- return nodeIdForLine(item.tocLineIndex);
481
- }
482
- if (item.folderPath?.length) {
483
- return nodeIdForFolder(item.folderPath);
484
- }
485
- if (item.tocLineIndex !== void 0) {
486
- return nodeIdForLine(item.tocLineIndex);
487
- }
488
- return `text:${item.text}`;
489
- }
490
- function parseNodeId(nodeId) {
491
- if (nodeId.startsWith("note:")) {
492
- return { kind: "note", noteIndex: nodeId.slice(5) };
493
- }
494
- if (nodeId.startsWith("folder:")) {
495
- const path2 = nodeId.slice(7);
496
- return {
497
- kind: "folder",
498
- folderPath: path2 ? path2.split("/") : []
499
- };
500
- }
501
- if (nodeId.startsWith("line:")) {
502
- return { kind: "line", tocLineIndex: Number(nodeId.slice(5)) };
503
- }
504
- return { kind: "text" };
505
- }
506
-
507
- // utils/tocHelpers.ts
508
- var TOC_INDENT_SPACES = 2;
509
- var TOC_LEGACY_FULL_REGEX = /^( *)(-\s+\[(x| )\])\s+\[(\d{4}\.[^\]]+)\]\(([^)]+)\)/;
510
- var TOC_NOTE_LINE_REGEX = /^( *)(-\s+\[(x| )\])\s+(\d{4})(?:\.\s*(.*))?\s*$/;
511
- var TOC_FOLDER_LINE_REGEX = /^( *)(-\s+(?!\[(?:x| )\]).+?)\s*$/;
512
- function extractNoteIndexFromTitle(text) {
513
- const match = text.match(/^(\d{4})\./);
514
- return match ? match[1] : null;
515
- }
516
- function parseIndent(spaces) {
517
- return Math.floor((spaces?.length ?? 0) / TOC_INDENT_SPACES);
518
- }
519
- function parseTocLine(line) {
520
- const rawLine = line ?? "";
521
- const empty = {
522
- kind: "unknown",
523
- isMatch: false,
524
- indentLevel: 0,
525
- noteIndex: null,
526
- folderTitle: null,
527
- completed: false,
528
- rawLine
529
- };
530
- if (line == null) return empty;
531
- const legacyMatch = line.match(TOC_LEGACY_FULL_REGEX);
532
- if (legacyMatch) {
533
- const [, spaces, , statusChar, titleText] = legacyMatch;
534
- const noteIndex = extractNoteIndexFromTitle(titleText);
535
- if (!noteIndex) return empty;
536
- return {
537
- kind: "note",
538
- isMatch: true,
539
- indentLevel: parseIndent(spaces),
540
- noteIndex,
541
- folderTitle: null,
542
- completed: statusChar === "x",
543
- rawLine
544
- };
545
- }
546
- const noteMatch = line.match(TOC_NOTE_LINE_REGEX);
547
- if (noteMatch) {
548
- const [, spaces, , statusChar, noteIndex] = noteMatch;
549
- return {
550
- kind: "note",
551
- isMatch: true,
552
- indentLevel: parseIndent(spaces),
553
- noteIndex,
554
- folderTitle: null,
555
- completed: statusChar === "x",
556
- rawLine
557
- };
558
- }
559
- const folderMatch = line.match(TOC_FOLDER_LINE_REGEX);
560
- if (folderMatch) {
561
- const [, spaces, titlePart] = folderMatch;
562
- const title = titlePart.replace(/^-\s+/, "").trim();
563
- if (!title) return empty;
564
- return {
565
- kind: "folder",
566
- isMatch: true,
567
- indentLevel: parseIndent(spaces),
568
- noteIndex: null,
569
- folderTitle: title,
570
- completed: false,
571
- rawLine
572
- };
573
- }
574
- return empty;
575
- }
576
- function isTocContentLine(line) {
577
- return parseTocLine(line).isMatch;
578
- }
579
- function resolveNoteFromIndex(index, notes) {
580
- return notes.find((n) => n.index === index);
581
- }
582
- function getTocLineCompleted(note, configOverride) {
583
- const config2 = configOverride ? { ...note.config, ...configOverride } : note.config;
584
- return config2?.done ?? false;
585
- }
586
- function buildFolderTocLine(title, indentLevel) {
587
- const indent = " ".repeat(indentLevel * TOC_INDENT_SPACES);
588
- return `${indent}- ${title}`;
589
- }
590
- function buildTocLine(note, indentLevel, completed) {
591
- const indent = " ".repeat(indentLevel * TOC_INDENT_SPACES);
592
- const status = completed ?? getTocLineCompleted(note) ? "x" : " ";
593
- return `${indent}- [${status}] ${note.dirName}`;
594
- }
595
- function mutableToTreeNode(node) {
596
- if (node.kind === "folder") {
597
- return {
598
- kind: "folder",
599
- title: node.title,
600
- indent: node.indent,
601
- tocLineIndex: node.tocLineIndex,
602
- children: node.children.map(mutableToTreeNode)
603
- };
604
- }
605
- return {
606
- kind: "note",
607
- noteIndex: node.noteIndex,
608
- indent: node.indent,
609
- tocLineIndex: node.tocLineIndex,
610
- children: node.children.map(mutableToTreeNode)
611
- };
612
- }
613
- function buildMutableTreeFromFlat(flatNodes) {
614
- const roots = [];
615
- const stack = [];
616
- for (const item of flatNodes) {
617
- while (stack.length > 0 && stack[stack.length - 1].indent >= item.indent) {
618
- stack.pop();
619
- }
620
- const node = {
621
- kind: item.kind,
622
- title: item.title,
623
- noteIndex: item.noteIndex,
624
- indent: item.indent,
625
- tocLineIndex: item.tocLineIndex,
626
- children: []
627
- };
628
- if (stack.length === 0) {
629
- roots.push(node);
630
- } else {
631
- stack[stack.length - 1].children.push(node);
632
- }
633
- stack.push(node);
634
- }
635
- return roots;
636
- }
637
- function parseTocToMutableTree(lines, notes) {
638
- const flatNodes = [];
639
- for (let lineIndex = 0; lineIndex < lines.length; lineIndex++) {
640
- const line = lines[lineIndex];
641
- const parsed = parseTocLine(line);
642
- if (!parsed.isMatch) continue;
643
- if (parsed.kind === "folder") {
644
- flatNodes.push({
645
- kind: "folder",
646
- title: parsed.folderTitle,
647
- indent: parsed.indentLevel,
648
- tocLineIndex: lineIndex
649
- });
650
- continue;
651
- }
652
- if (!parsed.noteIndex) continue;
653
- if (!resolveNoteFromIndex(parsed.noteIndex, notes)) continue;
654
- flatNodes.push({
655
- kind: "note",
656
- noteIndex: parsed.noteIndex,
657
- indent: parsed.indentLevel,
658
- tocLineIndex: lineIndex
659
- });
660
- }
661
- return buildMutableTreeFromFlat(flatNodes);
662
- }
663
- function parseTocToTree(lines, notes) {
664
- return parseTocToMutableTree(lines, notes).map(mutableToTreeNode);
665
- }
666
- function serializeTocTree(tree, notes, configByIndex) {
667
- const lines = [];
668
- function walk(nodes) {
669
- for (const node of nodes) {
670
- if (node.kind === "folder") {
671
- lines.push(buildFolderTocLine(node.title, node.indent));
672
- walk(node.children);
673
- continue;
674
- }
675
- const note = resolveNoteFromIndex(node.noteIndex, notes);
676
- if (!note) continue;
677
- const override = configByIndex?.get(node.noteIndex);
678
- const completed = override !== void 0 ? getTocLineCompleted(note, override) : getTocLineCompleted(note);
679
- lines.push(buildTocLine(note, node.indent, completed));
680
- walk(node.children);
681
- }
682
- }
683
- walk(tree);
684
- return lines;
685
- }
686
- function parseTocLinesToFlatNodes(lines) {
687
- const result = [];
688
- for (const line of lines) {
689
- const parsed = parseTocLine(line);
690
- if (parsed.kind !== "note" || !parsed.noteIndex) continue;
691
- result.push({
692
- noteIndex: parsed.noteIndex,
693
- indent: parsed.indentLevel,
694
- completed: parsed.completed
695
- });
696
- }
697
- return result;
698
- }
699
- function adjustTocLineIndexAfterSubtreeRemoval(lineIndex, removedStart, removedEnd) {
700
- if (lineIndex >= removedEnd) {
701
- return lineIndex - (removedEnd - removedStart);
702
- }
703
- return lineIndex;
704
- }
705
- function getTocEntrySubtreeRange(lines, lineIndex) {
706
- const parsed = parseTocLine(lines[lineIndex]);
707
- if (!parsed.isMatch) {
708
- return { start: lineIndex, end: lineIndex + 1 };
709
- }
710
- const baseIndent = parsed.indentLevel;
711
- let end = lineIndex + 1;
712
- for (let i = lineIndex + 1; i < lines.length; i++) {
713
- const next = parseTocLine(lines[i]);
714
- if (next.isMatch && next.indentLevel <= baseIndent) break;
715
- end = i + 1;
716
- }
717
- return { start: lineIndex, end };
718
- }
719
- function collectNoteIndexesInSubtree(lines, lineIndex) {
720
- const { start, end } = getTocEntrySubtreeRange(lines, lineIndex);
721
- const indexes = [];
722
- for (let i = start; i < end; i++) {
723
- const parsed = parseTocLine(lines[i]);
724
- if (parsed.noteIndex) {
725
- indexes.push(parsed.noteIndex);
726
- }
727
- }
728
- return indexes;
729
- }
730
- function renameFolderLine(lines, lineIndex, newTitle) {
731
- const parsed = parseTocLine(lines[lineIndex]);
732
- if (parsed.kind !== "folder") {
733
- throw new Error(`TOC \u884C ${lineIndex} \u4E0D\u662F\u76EE\u5F55\u884C`);
734
- }
735
- const trimmed = newTitle.trim();
736
- if (!trimmed) {
737
- throw new Error("\u76EE\u5F55\u6807\u9898\u4E0D\u80FD\u4E3A\u7A7A");
738
- }
739
- const result = [...lines];
740
- result[lineIndex] = buildFolderTocLine(trimmed, parsed.indentLevel);
741
- return result;
742
- }
743
- function getPreviousNoteIndexOutsideSubtree(lines, lineIndex) {
744
- const { start } = getTocEntrySubtreeRange(lines, lineIndex);
745
- let lastBefore = null;
746
- for (let i = 0; i < start; i++) {
747
- const parsed = parseTocLine(lines[i]);
748
- if (parsed.noteIndex) {
749
- lastBefore = parsed.noteIndex;
750
- }
751
- }
752
- return lastBefore;
753
- }
754
- function isNoteIndexInSubtree(lines, lineIndex, noteIndex) {
755
- const indexes = collectNoteIndexesInSubtree(lines, lineIndex);
756
- return indexes.includes(noteIndex);
757
- }
758
- function findFolderLineIndex(lines, folderPath) {
759
- const target = folderPath.join("/");
760
- const stack = [];
761
- for (let i = 0; i < lines.length; i++) {
762
- const parsed = parseTocLine(lines[i]);
763
- if (!parsed.isMatch) continue;
764
- while (stack.length > 0 && stack[stack.length - 1].indent >= parsed.indentLevel) {
765
- stack.pop();
766
- }
767
- if (parsed.kind === "folder") {
768
- const path2 = [...stack.map((s) => s.title), parsed.folderTitle].join("/");
769
- if (path2 === target) return i;
770
- stack.push({ title: parsed.folderTitle, indent: parsed.indentLevel });
771
- }
772
- }
773
- throw new Error(`TOC.md \u4E2D\u672A\u627E\u5230\u76EE\u5F55: ${folderPath.join(" > ")}`);
774
- }
775
- function findTocLineIndex(lines, noteIndex) {
776
- for (let i = 0; i < lines.length; i++) {
777
- const parsed = parseTocLine(lines[i]);
778
- if (parsed.noteIndex === noteIndex) return i;
779
- }
780
- throw new Error(`TOC.md \u4E2D\u672A\u627E\u5230\u7B14\u8BB0: ${noteIndex}`);
781
- }
782
- function getPreviousTocNoteIndex(lines, noteIndex) {
783
- const flat = parseTocLinesToFlatNodes(lines);
784
- const index = flat.findIndex((node) => node.noteIndex === noteIndex);
785
- if (index === -1) {
786
- throw new Error(`TOC.md \u4E2D\u672A\u627E\u5230\u7B14\u8BB0: ${noteIndex}`);
787
- }
788
- if (index <= 0) return null;
789
- return flat[index - 1].noteIndex;
790
- }
791
- function processTocEmptyLines(lines) {
792
- const result = [];
793
- let previousEmpty = false;
794
- for (let i = 0; i < lines.length; i++) {
795
- const line = lines[i];
796
- if (line === "") {
797
- const prev = i > 0 ? lines[i - 1] : null;
798
- const next = i < lines.length - 1 ? lines[i + 1] : null;
799
- if (prev && next && isTocContentLine(prev) && isTocContentLine(next)) {
800
- continue;
801
- }
802
- if (!previousEmpty) {
803
- result.push(line);
804
- previousEmpty = true;
805
- }
806
- } else {
807
- result.push(line);
808
- previousEmpty = false;
809
- }
810
- }
811
- return result;
812
- }
813
- function parseTocCompletedNotes(content) {
814
- const lines = content.split("\n");
815
- const noteMap = /* @__PURE__ */ new Map();
816
- for (const line of lines) {
817
- const parsed = parseTocLine(line);
818
- if (parsed.kind !== "note" || !parsed.noteIndex) continue;
819
- const noteIndex = parsed.noteIndex;
820
- const completed = parsed.completed;
821
- if (noteMap.has(noteIndex)) {
822
- const existing = noteMap.get(noteIndex);
823
- if (existing.completed !== completed) {
824
- throw new Error(
825
- `\u53D1\u73B0\u76F8\u540C\u7F16\u53F7 ${noteIndex} \u7684\u7B14\u8BB0\u6709\u4E0D\u540C\u7684\u5B8C\u6210\u72B6\u6001:
826
- \u7B2C\u4E00\u6B21\u51FA\u73B0: ${existing.line}
827
- \u7B2C\u4E8C\u6B21\u51FA\u73B0: ${line.trim()}`
828
- );
829
- }
830
- continue;
831
- }
832
- noteMap.set(noteIndex, {
833
- noteIndex,
834
- completed,
835
- line: line.trim()
836
- });
837
- }
838
- const notes = Array.from(noteMap.values());
839
- return {
840
- completedCount: notes.filter((n) => n.completed).length,
841
- totalCount: notes.length,
842
- notes
843
- };
844
- }
845
- function buildSidebarFromTocTree(tree, notes, options, parentFolderPath = []) {
846
- const collapsed = options.sidebarIsCollapsed ?? true;
847
- function mapNote(node, currentFolderPath) {
848
- const note = resolveNoteFromIndex(node.noteIndex, notes);
849
- if (!note) return null;
850
- let statusEmoji = "\u23F0 ";
851
- if (note.config?.done) {
852
- statusEmoji = "\u2705 ";
853
- }
854
- let displayText = note.dirName;
855
- if (!options.sidebarShowNoteId) {
856
- displayText = note.dirName.replace(/^\d{4}\.\s/, "");
857
- }
858
- const childItems = node.children.map((child) => mapNode(child, currentFolderPath)).filter((item2) => item2 !== null);
859
- if (childItems.length > 0) {
860
- const item2 = {
861
- text: statusEmoji + displayText,
862
- link: `/notes/${note.dirName}/README`,
863
- collapsed,
864
- items: childItems,
865
- tocLineIndex: node.tocLineIndex
866
- };
867
- item2.nodeId = computeSidebarNodeId(item2);
868
- return item2;
869
- }
870
- const item = {
871
- text: statusEmoji + displayText,
872
- link: `/notes/${note.dirName}/README`,
873
- tocLineIndex: node.tocLineIndex
874
- };
875
- item.nodeId = computeSidebarNodeId(item);
876
- return item;
877
- }
878
- function mapFolder(node, folderPath) {
879
- const childItems = node.children.map((child) => mapNode(child, folderPath)).filter((item2) => item2 !== null);
880
- if (childItems.length === 0) {
881
- const item2 = {
882
- text: node.title,
883
- collapsed,
884
- items: [],
885
- folderPath,
886
- tocLineIndex: node.tocLineIndex
887
- };
888
- item2.nodeId = computeSidebarNodeId(item2);
889
- return item2;
890
- }
891
- const item = {
892
- text: node.title,
893
- collapsed,
894
- items: childItems,
895
- folderPath,
896
- tocLineIndex: node.tocLineIndex
897
- };
898
- item.nodeId = computeSidebarNodeId(item);
899
- return item;
900
- }
901
- function mapNode(node, currentFolderPath) {
902
- if (node.kind === "folder") {
903
- const folderPath = [...currentFolderPath, node.title];
904
- return mapFolder(node, folderPath);
905
- }
906
- return mapNote(node, currentFolderPath);
907
- }
908
- return tree.map((node) => mapNode(node, parentFolderPath)).filter((item) => item !== null);
909
- }
910
-
911
479
  // utils/migrateReadmeToToc.ts
912
480
  var README_TOC_END_TAG = "<!-- endregion:toc -->";
913
481
  function extractReadmeBodyAfterToc(content) {
@@ -1829,34 +1397,6 @@ import {
1829
1397
  import { writeFileSync as writeFileSync2, readFileSync as readFileSync2, promises as fsPromises } from "fs";
1830
1398
  import { join as join3 } from "path";
1831
1399
  import { v4 as uuidv4 } from "uuid";
1832
-
1833
- // config/templates.ts
1834
- var NEW_NOTES_README_MD_TEMPLATE = `
1835
- <!-- region:toc -->
1836
-
1837
- - [1. \u672C\u8282\u5185\u5BB9](#1-\u672C\u8282\u5185\u5BB9)
1838
- - [2. \u8BC4\u4EF7](#2-\u8BC4\u4EF7)
1839
-
1840
- <!-- endregion:toc -->
1841
-
1842
- ## 1. \u672C\u8282\u5185\u5BB9
1843
-
1844
- - todo
1845
-
1846
- ## 2. \u8BC4\u4EF7
1847
-
1848
- - todo
1849
- `;
1850
- function getNewNoteReadmeBody() {
1851
- return NEW_NOTES_README_MD_TEMPLATE;
1852
- }
1853
- function generateNoteTitle(noteIndex, title, repoUrl) {
1854
- const dirName = `${noteIndex}. ${title}`;
1855
- const encodedDirName = encodeURIComponent(dirName);
1856
- return `# [${dirName}](${repoUrl}/${encodedDirName})`;
1857
- }
1858
-
1859
- // services/note/service.ts
1860
1400
  var NoteService = class _NoteService {
1861
1401
  constructor() {
1862
1402
  this.ignoredConfigPaths = /* @__PURE__ */ new Set();
@@ -5690,16 +5230,10 @@ export {
5690
5230
  ROOT_TOC_PATH,
5691
5231
  ROOT_CONFIG_PATH,
5692
5232
  handleError,
5693
- generateAnchor,
5694
5233
  logger,
5695
5234
  createLogger,
5696
5235
  parseArgs,
5697
5236
  parseReadmeCompletedNotes,
5698
- resolveNoteFromIndex,
5699
- buildFolderTocLine,
5700
- buildTocLine,
5701
- processTocEmptyLines,
5702
- parseTocCompletedNotes,
5703
5237
  migrateReadmeToToc,
5704
5238
  runCommand,
5705
5239
  NoteManager,
@@ -0,0 +1,11 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }// 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
+ };
8
+
9
+
10
+
11
+ exports.generateAnchor = generateAnchor;