Last active
June 17, 2022 02:43
-
-
Save bennewton999/96089b5a13ded6251fffc298119f38a3 to your computer and use it in GitHub Desktop.
This is a templater template for Obsidian that will show today's newly added highlights from Readwise. This will require a change in the Readwise Output for the highlight section in the plugin's settings. #newHighlight-{{date|date('F-j-Y')}} will have to be added to the first line of the Highlights Header Section of the Template. More work neede…
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```dataviewjs | |
const today = new Date('<% tp.date.now() %> 12:00:00 AM'); | |
const dateOptions = {month: 'long', day: 'numeric', year: 'numeric'}; | |
const todayFormatted = new Date('<% tp.date.now() %> 12:00:00 AM').toLocaleDateString(undefined, dateOptions); | |
const month = today.toLocaleString('default', { month: 'long' }); | |
const day = today.getDate(); | |
const year = today.getFullYear(); | |
const tag = `#newHighlight-${month}-${day}-${year}`; | |
const books = dv.pages(tag) | |
if (books.length === 0) { | |
dv.paragraph("No Highlights Today") | |
} else { | |
dv.table(["Book", "Author"], | |
books.map(b => [ | |
"[[" + b.file.name + "##New highlights added " + todayFormatted + "|"+b.file.name+"]]", | |
b.author | |
])); | |
} | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment