Hypothes.is + Obsidian = Hypothesidian for easier note taking and formatting

Anyone who knows me knows that I love Hypothes.is for all my online highlighting, annotating, and general note taking. They also know that if one isn’t actively using their notes to some better end, then it’s likely not worth having taken them at all, so I store mine in markdown in Obsidian for future-proofing and portability.

Hypothes.is + Obsidian

A while back I came across RoamHacker’s work to dovetail Hypothes.is for use in Obsidian and finally managed to get it up and running with my Obsidian vault. I’ve previously outlined a method for pulling in my notes from Hypothes.is using RSS, however this doesn’t give one any formatting capabilities and it also doesn’t provide any of the Hypothes.is tags as RSS has no layer for taxonomies.

RoamHacker’s work, which leverages the Templater Plugin for Obsidian, fixes both of these problems. I suspect that I’ll keep my prior method in place to create the individual notes, but use this additional work to clean up my fleeting notes from Hypothes.is in my actual commonplace book. Since there’s no server involved, it’s harder to automate the entire process so that every time you create notes they’re automatically ported across either in real-time or in batches every few hours.

Formatting your notes

I did spend some time last night to modify some of RoamHacker’s code to re-format the annotations to better suit my current notes format and layout. I’m excerpting the most relevant part below, but the entire Gist can also be downloaded or further modified for easier copy/pasting into one’s own vault for the needed set up.

I’ve only modified the section of the original Gist at the bottom that follows the line:
/* TEMPLATE STARTS HERE */

The changes still keep all the relevant data fields, but reorder them and add a bit of formatting to fit the layout and the way I use my Obsidian notebook. I changed the formatting so that tags in Hypothes.is are turned into [[wikilinks]] rather than #⁠hashtags as in the original. (The original also doesn’t do so well with multi-word tags, which I use quite a lot.)

Hopefully the small changes I’ve made and comparison with the original Gist will allow those who aren’t as code-savvy to better understand the template and potentially let them make changes to suit their own needs.

/* TEMPLATE STARTS HERE */
if (tp.file.content.length==0) {
//likely a new document, insert front matter
tR += `---\n`;
tR += `fileType: HypothesisAnnotations\n`;
tR += `creationDate: ${tp.date.now('YYYY-MM-DD')} \n`;
tR += `annotationDate: ${articleAnnotations[0].created.substring(0,10)}\n`;
tR += `uri: ${articleAnnotations[0].uri}\n`;
tR += `---\n`;
}

tR += `# ${articleAnnotations[0].title}\n`
tR += `URL: ${articleAnnotations[0].uri}\n\n`

for( a of articleAnnotations) {
let tags = '';
let user = '';
if(a.tags.length>0) tags = ' ' + (a.tags.map(t=> '[['+ t + ']]')).join(' ');
if(insertUser) user = ' _(' + a.user.replace('acct:','').replace('@hypothes.is','') + ')_';
if(a.text) tR += `${a.text}\n&mdash;[[${user}]]\n\n`;
tR += `## Source \n`;
tR += `> ${a.highlight}[^1]\n\n`;
tR += `[^1]: [${articleAnnotations[0].title}](${articleAnnotations[0].uri}) | [syndication link](tk) \n`;
tR += `\n---\ntags: \nlinks: ${tags} \n- broader terms (BT): \n- narrower terms (NT): \n- related terms (RT): \n- used for (UF) or aliases: \nconnected ideas: \nMOC: \n\n---\n`;
}
%>