mirror of
https://github.com/idreesinc/Waypoint.git
synced 2026-07-22 06:20:32 +00:00
actually fix the links this time
This commit is contained in:
parent
0558cd53c7
commit
164a2e2004
1 changed files with 5 additions and 6 deletions
11
main.ts
11
main.ts
|
|
@ -147,10 +147,9 @@ export default class Waypoint extends Plugin {
|
|||
* @returns The string representation of the tree, or null if the node is not a file or folder
|
||||
*/
|
||||
async getFileTreeRepresentation(root_node: TFolder, cur_node: TAbstractFile, indentLevel: number, topLevel = false): Promise<string>|null {
|
||||
let pathFromRootNode = function() {
|
||||
let prefix_len = root_node.path.length;
|
||||
let link = cur_node.path.substring(prefix_len);
|
||||
return `./${encodeURI(link)}`
|
||||
let pathFromRootNode = function(node: TAbstractFile) {
|
||||
let prefix_len = root_node.path.length + 1;
|
||||
return `./${encodeURI(node.path.substring(prefix_len))}`;
|
||||
};
|
||||
const bullet = " ".repeat(indentLevel) + "-";
|
||||
if (cur_node instanceof TFile) {
|
||||
|
|
@ -158,7 +157,7 @@ export default class Waypoint extends Plugin {
|
|||
if (this.settings.useWikiLinks) {
|
||||
return `${bullet} [[${cur_node.basename}]]`;
|
||||
} else {
|
||||
return `${bullet} [${cur_node.basename}](${pathFromRootNode()})`;
|
||||
return `${bullet} [${cur_node.basename}](${pathFromRootNode(cur_node)})`;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
|
@ -169,7 +168,7 @@ export default class Waypoint extends Plugin {
|
|||
if (this.settings.useWikiLinks) {
|
||||
text = `${bullet} **[[${folderNote.basename}]]**`;
|
||||
} else {
|
||||
text = `${bullet} **[${folderNote.basename}](./${pathFromRootNode()})**`;
|
||||
text = `${bullet} **[${folderNote.basename}](${pathFromRootNode(folderNote)})**`;
|
||||
}
|
||||
if (!topLevel) {
|
||||
if (this.settings.stopScanAtFolderNotes) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue