World of Textfiles: Meeting Notes

As I wrote earlier, I have been experimenting with keeping my personal knowledge system on my own computers and in plaintext.

I have been working on and off on a too large blogpost trying to explain every part of it… but it is overwhelming.

I recently updated a part of the whole system, and I thought I’d show you roughly how it works.

Where Text Starts: Drafts

If an idea starts to form and I’m taking notes, it often makes its way into Drafts. Often those notes are more associated with an event on my calendar than any particular topic or area of knowledge. This is where I use my Meeting Notes action.

It used to be a iOS Shortcut, but I recently rewrote it as a pure js action in Drafts… annotated below. (If you just want to read the full source, click here.)

var calendars = ["list", "of", "calendars", "I", "want", "to", "query"];

var today     = new Date();
var yesterday = new Date(today.getTime() - 1000*60*60*24);

var print_event = (e) => `${strftime(e.startDate, "%R")} - ${e.title}`;

var events = calendars
             .reduce((e, c) => e.concat(Calendar.find(c).events(yesterday, today)), [])
             .sort((a, b) => a.startDate - b.startDate)
             .reverse()
             .filter(e => !e.isAllDay)

Here we are finding all the events on the calendars by name that we might want to attach this note to. There’s some cleverness in the Array.prototype.reduce, but all it does is iterate through the calendar names in var calendars and find the last 24 hours of calendar items.

print_event() is a helper function we’ll use both to create the menu, and later to make sure we have the right event selected. It uses the new es6 template strings which are pretty nifty.

var event_template =
  MustacheTemplate.createWithTemplate(Draft.find("<uuid of an appropriate template draft>").content);

I’m pretty proud of this method… previously I had been doing a lot of String.prototype.replace to fill in a template with the variables that I had supplied… this is a lot simpler. The template itself is in another draft, and looks like this:

# {{title}} :: {{startDate}}

## Description

{{notes}}

## Notes

I have a several drafts that just store templates for other actions, they have a tag of template and live in a Workspace just for Templates.

Returning to the script:

var p = Prompt.create();

p.title = "Meeting Note";
p.message = "Choose an event. the current draft will be appended to the template and tagged `meeting`.";

if (events) {
  var event_names = events.map(e => print_event(e));

  p.addSelect("event", "Events", event_names, [], false);
  p.addButton("Create Meeting Note");

  prompt = p.show();

This is a little messy… but I’m essentially setting up some UI bits to show the user a list of events… that way we can choose which event to associate our notes with!

We use that helper function we defined earlier print_event() to build the select for the Prompt.

  if (p.buttonPressed == "Create Meeting Note") {
   // process the event
      event = events.find(e => print_event(e) == p.fieldValues["event"])

      var data = {
        "title": event.title,
        "startDate": event.startDate,
        "notes": event.notes
      };

      result = event_template.render(data);

      draft.addTag("meeting");
      draft.content = result + "\n" + draft.content;
      draft.update();
  }
}

This is pretty much the rest of it. After we’ve selected a note, (comparing it to the print_event() string since that’s what we get from p.fieldValues[]), get some values out of the event to make an object to pass to MustacheTemplate.render, and prepend that template to the current draft.

In my actual version, I have a few more customizations. For instance, if the event is coming from a work calendar, then I add some tags related to my work.

As it is, you’ll have a nice little file with your notes, and all the pertinent information about the event. I have a Workspace in drafts just for Meeting Notes (tagged meeting), and it’s a pretty great place to remember what was said or decided.

Where Text Lives: My wiki

I’m currently using vimwiki out of dropbox to store and link my notes. To get my note from Drafts to vimwiki, I use an updated version of the action I talked about in a previous post, but the basic principle is the same. If a Draft has the tag of meeting, Magic Wiki basically does this:

if (draft.hasTag("meeting")) {
  path_fragment = "diary";

  filename =
    draft
    .title
    .split("::")
    .slice(-1)[0]
    .trim()
  }
    var path = "/wiki/" + path_fragment + "/" + filename + ".md";

  var db = Dropbox.create();
  var check = db.write(path, content, "append");
}

Since our template uses the “::” string to delimit the time, Magic Wiki will make a new file in my diary folder by the name of the moment that it occurred. Vimwiki automagically pulls up the name of the event by the first markdown <h1> title in the document, and builds a nice little index of all the meeting notes in the Diary view.

Plaintext ftw.

It’s always a little bit in flux, but this makes it really easy to put something in the “right place” for me to find it later. Even if I give up vimwiki for something else, I’ve still got a bunch of markdown files named for the time of the meeting and with all the pertinent information saved alongside my notes.

If you have a cool trick, let me know. I’ll probably clean this up and figure out how to publish it to the Actions Directory.


Changelog
  • 2019-09-24 09:06:59 -0500

    Update script with this morning's changes/video

    End in the evening with a blog post about the things I plan to do...
    post in the morning having made those changes. ¯\(°_o)/¯

  • 2019-09-23 21:46:39 -0500

    Draft: Meeting Notes