note icon on backlinks (#104)

This commit is contained in:
Utsob Roy 2023-03-17 01:35:49 +06:00 committed by GitHub
parent 80d8ce1463
commit aa3f892116
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 6 deletions

View File

@ -51,6 +51,7 @@ function getGraph(data) {
outBound: extractLinks(v.template.frontMatter.content),
neighbors: new Set(),
backLinks: new Set(),
noteIcon: v.data.noteIcon || process.env.NOTE_ICON_DEFAULT
};
stemURLs[fpath] = v.url;
if (v.data["dg-home"] || (v.data.tags && v.data.tags.indexOf("gardenEntry") > -1)) {

View File

@ -38,6 +38,13 @@ module.exports = async () => {
bodyClasses.push("links-note-icon");
noteIconsSettings.links = true;
}
if (
process.env.NOTE_ICON_BACK_LINKS &&
process.env.NOTE_ICON_BACK_LINKS == "true"
) {
bodyClasses.push("backlinks-note-icon");
noteIconsSettings.backlinks = true;
}
let timestampSettings = {
timestampFormat: process.env.TIMESTAMP_FORMAT || "MMM dd, yyyy h:mm a",
showCreated: process.env.SHOW_CREATED_TIMESTAMP == "true",

View File

@ -62,7 +62,7 @@
{%- for backlink in graph.nodes[graph.homeAlias].backLinks -%}
{%- if graph.nodes[backlink].url != graph.homeAlias -%}
<div class="backlink-card">
<i icon-name="link"></i> <a href="{{graph.nodes[backlink].url}}">{{graph.nodes[backlink].title}}</a>
{%- if not meta.noteIconsSettings.backlinks -%}<i icon-name="link"></i> {%- endif -%}<a href="{{graph.nodes[backlink].url}}" data-note-icon="{{graph.nodes[backlink].noteIcon}}" class="backlink">{{graph.nodes[backlink].title}}</a>
</div>
{%- endif -%}
{%- endfor -%}
@ -75,7 +75,7 @@
{%- for backlink in graph.nodes[page.url].backLinks -%}
{%- if graph.nodes[backlink].url != page.url -%}
<div class="backlink-card">
<i icon-name="link"></i> <a href="{{graph.nodes[backlink].url}}">{{graph.nodes[backlink].title}}</a>
{%- if not meta.noteIconsSettings.backlinks -%}<i icon-name="link"></i> {%- endif -%}<a href="{{graph.nodes[backlink].url}}" data-note-icon="{{graph.nodes[backlink].noteIcon}}" class="backlink">{{graph.nodes[backlink].title}}</a>
</div>
{%- endif -%}
{%- endfor -%}

View File

@ -691,7 +691,8 @@ input[type="range"]::-webkit-slider-thumb {
body.title-note-icon .cm-s-obsidian > header > h1[data-note-icon]::before,
body.filetree-note-icon .filename[data-note-icon]::before,
body.links-note-icon .internal-link[data-note-icon]::before {
body.links-note-icon .internal-link[data-note-icon]::before,
body.backlinks-note-icon .backlink[data-note-icon]::before {
content: " ";
display: inline-block;
width: 0.9em;
@ -704,19 +705,22 @@ body.links-note-icon .internal-link[data-note-icon]::before {
body.title-note-icon .cm-s-obsidian > header > h1[data-note-icon="1"]::before,
body.filetree-note-icon .filename[data-note-icon="1"]::before,
body.links-note-icon .internal-link[data-note-icon="1"]::before {
body.links-note-icon .internal-link[data-note-icon="1"]::before,
body.backlinks-note-icon .backlink[data-note-icon="1"]::before {
background-image: var(--note-icon-1);
}
body.title-note-icon .cm-s-obsidian > header > h1[data-note-icon="2"]::before,
body.filetree-note-icon .filename[data-note-icon="2"]::before,
body.links-note-icon .internal-link[data-note-icon="2"]::before {
body.links-note-icon .internal-link[data-note-icon="2"]::before,
body.backlinks-note-icon .backlink[data-note-icon="2"]::before {
background-image: var(--note-icon-2);
}
body.title-note-icon .cm-s-obsidian > header > h1[data-note-icon="3"]::before,
body.filetree-note-icon .filename[data-note-icon="3"]::before,
body.links-note-icon .internal-link[data-note-icon="3"]::before {
body.links-note-icon .internal-link[data-note-icon="3"]::before,
body.backlinks-note-icon .backlink[data-note-icon="3"]::before {
background-image: var(--note-icon-3);
}