Skip to content

Build your personal knowledge base with Trilium Notes

feat(text): improve display of reference links with bookmarks

Elian Doran7219fc875d66
diff --git a/apps/client/src/services/link.ts b/apps/client/src/services/link.ts
index b6c5dbfdb6..1e375a994a 100644
--- a/apps/client/src/services/link.ts
+++ b/apps/client/src/services/link.ts
@@ -434,6 +434,13 @@ async function loadReferenceLinkTitle($el: JQuery<HTMLElement>, href: string | n
const title = await getReferenceLinkTitle(href);
$el.text(title);
+ if (viewScope?.bookmark) {
+ $el.append($("<small>").append(
+ $("<span>").addClass("bx bx-bookmark"),
+ document.createTextNode(viewScope.bookmark)
+ ));
+ }
+
if (note) {
const icon = await getLinkIcon(noteId, viewScope.viewMode);
@@ -459,8 +466,8 @@ async function getReferenceLinkTitle(href: string) {
return attachment ? attachment.title : "[missing attachment]";
}
- return note.title;
+ return note.title;
}
function getReferenceLinkTitleSync(href: string) {
@@ -483,8 +490,12 @@ function getReferenceLinkTitleSync(href: string) {
return attachment ? attachment.title : "[missing attachment]";
}
- return note.title;
+ if (viewScope?.bookmark) {
+ return `${note.title} - ${viewScope.bookmark}`;
+ }
+
+ return note.title;
}
if (glob.device !== "print") {
diff --git a/apps/client/src/stylesheets/theme-next/notes/text.css b/apps/client/src/stylesheets/theme-next/notes/text.css
index 5e58895ef5..8832d9a9cf 100644
--- a/apps/client/src/stylesheets/theme-next/notes/text.css
+++ b/apps/client/src/stylesheets/theme-next/notes/text.css
@@ -714,6 +714,15 @@ html .note-detail-editable-text :not(figure, .include-note, hr):first-child {
text-decoration: underline;
}
+.ck-content a.reference-link small {
+ margin-left: 0.25em;
+ opacity: 0.5;
+
+ >span {
+ font-size: 0.7em;
+ }
+}
+
/*
* Read-only text content
*/