Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/constants.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
export const MM_VIEW_TYPE = 'mindmap';
export const MD_VIEW_TYPE = 'markdown';
export const MD_VIEW_TYPE = 'markdown';

// https://regex101.com/r/gw85cc/2
export const INTERNAL_LINK_REGEX = /\[\[(?<wikitext>.*)\]\]|<a href="(?<mdpath>.*)">(?<mdtext>.*)<\/a>/gim;
// https://regex101.com/r/aWdgvf/1
export const INTERNAL_LINK_REGEX = /\[\[(?<wikitext>.*?)((\|)(?<wikialias>.*)\]\]|\]\])|<a href="(?<mdpath>.*)">(?<mdtext>.*)<\/a>/gim;

// https://regex101.com/r/Yg7HuO/2
export const FRONT_MATTER_REGEX = /^(---)$.+?^(---)$.+?/ims;
export const FRONT_MATTER_REGEX = /^(---)$.+?^(---)$.+?/ims;
12 changes: 9 additions & 3 deletions src/obsidian-markmap-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,14 @@ export default class ObsidianMarkmap {
for (let i = 0; i < matches.length; i++) {
const match = matches[i];
const isWikiLink = match.groups['wikitext'];
const linkText = isWikiLink ? match.groups['wikitext'] : match.groups['mdtext'];
const linkPath = isWikiLink ? linkText : match.groups['mdpath'];
var linkText, linkPath;
if (isWikiLink) {
linkText = match.groups['wikialias'] ? match.groups['wikialias'] : match.groups['wikitext'];
linkPath = match.groups['wikitext'];
} else {
linkText = match.groups['mdtext'];
linkPath = match.groups['mdpath'];
}
if(linkPath.startsWith('http')){
continue;
}
Expand All @@ -41,4 +47,4 @@ export default class ObsidianMarkmap {
return matches;
}

}
}