Skip to content

Commit

Permalink
internal links fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dy-sh committed Apr 15, 2021
1 parent 101a83b commit bf5b267
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "consistent-attachments-and-links",
"name": "Consistent attachments and links",
"version": "1.0.6",
"version": "1.0.7",
"minAppVersion": "0.9.12",
"description": "This plugin ensures the consistency of attachments and links",
"author": "Dmitry Savosh",
Expand Down
3 changes: 3 additions & 0 deletions src/files-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,9 @@ export class FilesHandler {
for (let l of links) {
let link = this.lh.splitLinkToPathAndSection(l.link).link;

if (link.startsWith("#")) //internal section link
continue;

if (link.endsWith(".md"))
continue;

Expand Down
7 changes: 5 additions & 2 deletions src/links-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ export class LinksHandler {
//!!! this can return undefined if note was just updated
let links = this.app.metadataCache.getCache(note.path)?.links;
if (links) {
for (let link of links) {
for (let link of links) {
if (this.checkIsCorrectWikiLink(link.original))
continue;

Expand Down Expand Up @@ -644,7 +644,7 @@ export class LinksHandler {
if (notePath == filePath)
continue;

let links = await this.getLinksFromNote(notePath);
let links = await this.getLinksFromNote(notePath);
for (let link of links) {
let li = this.splitLinkToPathAndSection(link.link);
let linkFullPath = this.getFullPathForLink(li.link, notePath);
Expand Down Expand Up @@ -790,6 +790,9 @@ export class LinksHandler {
let isMarkdownLink = this.checkIsCorrectMarkdownLink(link.original);
let isWikiLink = this.checkIsCorrectWikiLink(link.original);
if (isMarkdownLink || isWikiLink) {
if (link.link.startsWith("#")) //internal section link
continue;

let file = this.getFileByLink(link.link, notePath);
if (file)
continue;
Expand Down
1 change: 1 addition & 0 deletions versions.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"1.0.7": "0.9.12",
"1.0.6": "0.9.12",
"1.0.5": "0.9.12",
"1.0.4": "0.9.12",
Expand Down

0 comments on commit bf5b267

Please sign in to comment.