@danbburg

Also, it seems to me those week numbers can be links to weekly review notes for people that do that sort of thing. And also bold those week numbers if a weekly review note exists.

@ryanjamurphy’s KBM macro can be set to run often enough to keep the calendar current. Like every time the Obsidian window has focus. With The Archive app people often did this to create a tag cloud list and keep it current. It is a bit of a klugy way to keep it updated but until there is a calendar plugin it would do.

I am sure you can do something similar on ubuntu to keep the calendar up to date.

I also like how @matthewpmunger has the year and month header links at the beginning.

That would be “a nice” to have.

Maybe provide a count of daily and weekly notes that you find exists by month and maybe a total at the end. People that do notes love stats.

The more you can automate the less I and maybe others have to fiddle with. Thank you for offering to help.

Great script and a great idea. Thanks.

@Mike

All good ideas. I didn’t get a chance to update with all of them but I did add in the check for whether or not the daily note exists or not. Based on this I added a few options:

  • dailyNotePath : path to daily notes, needed to check file existence
  • checkFileExists : check for file existence or not. if false then it is the same as before. if true then the following options are allowed based on whether a file exists
  • linkNonExisting : if false, then days with non existent daily notes will NOT be made into links. This helps clean up the graph view and differentiate between existing/non-existing notes.
  • hle : highlight characters for existing notes, e.g. if hle="**" then you get **[[ link | display ]]** could also set to “==” to highlight or an emoji to wrap date in a set of emojis
  • hlne : same thing but for non existing files

A few other updates:

  • I am interested in adding some statistics, but for now I just had it print the number of daily notes found in the date range.
  • I also updated it to use printf instead of echo so it should be more portable - no problem with echo -n.
  • I added a variable to control the date executable so that you can easily set it to gdate on OS X
  • I tested this updated version on OS X - but if people find problems let me know.

I’ll try to get to the other features you mentioned when I have more time like linking the week number to a weekly note etc.

The updated version is at the same gist above

For example you can now do something like the following with:
linkNonExisting=false and
hle="**"

2 Likes

Very good. Bravo! :clap: I do hope more people take a look at this and ponder additional options. This seems like a very good prototype proof of concept approach for a calendar daily note plugin.

I did a little testing before breaking for lunch and it worked just as you described on macOS.

I did change the following:

From:
displayFormat="%d"
To
displayFormat="%e"

I am guessing as a default folks might want 1-9 instead of 01-09.
I used %d in the script I posted yesterday but like %e better, the way @matthewpmunger’s displayed.

Here are a few things to consider:

  • Make the name of the file a variable so folks can change the name of the file in one place if they need or want.
  • Also need a path variable for where to write the file. I keep my daily notes in one folder and the index or calendar for them in the root of my vault.
  • Place all the user-configurable variables near the top together in a section so folks won’t need to dig through the source for what they need to change.
  • Would be nice to highlight today’s date by wrapping it with ==.

It would look like this:

I think once you finish, your script will be very useful to many people.
Great idea and nice work.

The customizable script for the calendar looks awesome! Thank you so much for creating and sharing this. :slight_smile:

I personally ran into a problem with formatting the daily note title properly, as I’m currently using the MMMM Do, YYYY format, which has a “-th”, “-nd”, “st” or “-rd” suffix after each day, so I can get titles like “July 23rd, 2020”. I tried looking online but I don’t think they include ordinal suffixes as a formatting option, and I’m not so familiar with bash script. Is there a workaround for this that I don’t know of?

I found this shell scripting tip site for doing original numbers. To use the function it suggests seems doable.

Here is the function it suggests for handling ordinals:

#!/bin/bash

function ordinal () {
  case "$1" in
    *1[0-9] | *[04-9]) echo "$1"th;;
    *1) echo "$1"st;;
    *2) echo "$1"nd;;
    *3) echo "$1"rd;;
  esac
}

I am sure that can be weaved into building the link string by passing it the day of the month.

Do you have the skills for incorporating this into building your link string?

1 Like

hi, I wanna know how to not display these connections between days and calendar in the Graph. I’ve tried script like ‘[[20200604|4]]’ and ‘[23](2020-08-23)’, there always have a line in the Graph.

If you have good method , plz tell me. thx.

1 Like

This kind of filtering is not yet possible. Soon!

1 Like

Hi @asun, glad you found it helpful. I made a quick update to allow insertion of the ordinal suffix by adding XX into the template string right after the day number (%d or %e etc.). See if it works for you - the default version in the gist has this in as an example.

I made a few other quick updates based on @Mike’s suggestions:

  • outputFile specifies the output filename, can be either a relative (just filename like calendar.md) or a full path
  • hlt provides the string to use for highlighting today’s date, e.g. ==

Note about the day number. You can use %e but that pads 1-digit numbers with a space. If you want the one digit day number without a leading zero you can use %-d

when I have more time I’ll come back to the other ideas.


Yep, also interested. Is there a way of linking that I didn’t notice and that doesn’t create backlinks?

See my reply to RyanWu :point_up:

2 Likes

Thanks :slight_smile:

Any way how to make it not depended on fixed naming convention?
I just edit script and add my ISO date formating and script should extract all the parts like: date, month day, a rebuild the note name when creating calendar.

I tried to edit current script with my ISO formatting:

linkformat="%ww' %DD-%MMM (%ddd) %Y"

But it create empty calendar.

how can I run it in Windows? :flushed:

1 Like

@jcperezh Because it uses date or gdate it will not run on windows natively. That are utilities only available on linux (or OSX)

You could try to install the Ubuntu (command line) from the windows store and run it from there.

Yes…that is what I did.

done! work great. im now trying to translate it to german (doesn’t work when the linux language is not English) this is my first attempt with .sh and i am trying to change the “Mon” and “Sun” with $hMon and $hSun so i can just translate the headers. not successful yet.

1 Like

@jcperezh That’s weird your approach should work. You have to change the other occurrences if “Mon” and “Sun” as well later in the code.

You are right, the language of the date command changes with the system language.
This can be prevented running the script a temporary environmental variable:

LANG=en_US ./md-cal.sh

Note: Don’t for get to make the script executable first: chmod +x ./md-cal.sh

done! i don’t know the syntax yet and didn’t use “$hSun”, just $hSun without the quotation marks :flushed: :roll_eyes:. it work perfect.

Edit: Now it is getting interesting, Week number in Europa and in USA are not the same…
Edit_2: %V instead of %W solved it (ISO Standard)


I created a link also to my Week-Note to the Week Number

3 Likes

Python script version (customizable) with KB script makro script!

3 Likes

I think it’s because the link is in a table. If you escape the pipe, it’s not gonna show: [[20200604\|4]] in preview mode.