@danbburg, perfect! Thanks for the script!
I’m using dates with spaces (e.g. linkFormat="%Y-%m-%d (%A)"
-> 2020-10-19 (Monday)
) so I had to change all instances of $date_cmd +$linkTemplate
to have quotes: $date_cmd +"$linkTemplate"
, or else date
thinks there’s more than one argument.
Also, I didn’t like the non-existing notes link to have a blue color (hard to distinguish, despite the existing ones being bold), so I cleared all highlights (hle
, hlne
, hlt
), added a span with a class to both dates:
if [ -e "$testFile" ]; then # Daily note file exists
printf "| $hil$hle<span class=\"journal-calendar-date\">[[ %s \| %s ]]</span>$hle$hil " "`$date_cmd +"$linkTemplate" […]
elif [ "$linkNonExisting" == true ]; then # Daily note file does not exists, but still make a link
printf "| $hil$hlne<span class=\"journal-calendar-date\">[[ %s \| %s ]]</span>$hlne$hil " "`$date_cmd +"$linkTemplate" […]
and added it to obsidian.css
:
.journal-calendar-date a.internal-link.is-unresolved {
color: white;
}
This way there’s no need to re-run the script to check for existing notes (just run it once per year!) and the style will change automatically.
Result:
Thanks again!