mirror of
https://github.com/yildbs/obsidian-harada-method-plugin.git
synced 2026-07-22 07:40:28 +00:00
implement internal link
This commit is contained in:
parent
4d00a194d8
commit
e74e7c09f4
1 changed files with 17 additions and 1 deletions
|
|
@ -133,7 +133,23 @@ export class HaradaMethod extends MarkdownRenderChild {
|
|||
cell.id = 'action';
|
||||
}
|
||||
|
||||
cell.textContent = content;
|
||||
// check internal link
|
||||
const regex = /\[\[(.*?)\]\]/;
|
||||
const match = content.match(regex);
|
||||
if (match != null){
|
||||
const matched_text = match[1];
|
||||
const split = matched_text.split("|");
|
||||
const path = split[0];
|
||||
let title = split[1] ?? split[0];
|
||||
|
||||
const a = cell.createEl('a');
|
||||
a.text = title;
|
||||
a.href = path;
|
||||
a.addClass("internal-link");
|
||||
}
|
||||
else{
|
||||
cell.textContent = content;
|
||||
}
|
||||
row.appendChild(cell);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue