Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/liamcain/obsidian-daily-notes-interface
Package to create, open, and find daily notes from your Obsidian plugin
https://github.com/liamcain/obsidian-daily-notes-interface
obsidian-md
Last synced: about 2 months ago
JSON representation
Package to create, open, and find daily notes from your Obsidian plugin
- Host: GitHub
- URL: https://github.com/liamcain/obsidian-daily-notes-interface
- Owner: liamcain
- License: mit
- Created: 2020-11-20T02:17:03.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2024-08-19T22:11:44.000Z (4 months ago)
- Last Synced: 2024-10-01T09:41:43.898Z (2 months ago)
- Topics: obsidian-md
- Language: TypeScript
- Homepage:
- Size: 258 KB
- Stars: 82
- Watchers: 4
- Forks: 10
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
- awesome-obsidian - obsidian-daily-notes-interface:
README
[![NPM](https://nodei.co/npm/obsidian-daily-notes-interface.png?mini=true)](https://npmjs.org/package/obsidian-daily-notes-interface)
# Obsidian Daily Notes interface
A collection of utility functions for working with dates and daily notes in Obsidian plugins. It reads from the user's Daily Notes settings to provide a consistent interface.
## Installation
The best way to use this package is to add it to your dependencies:
```
# if you use npm:
npm install --save obsidian-daily-notes-interface# or if you use Yarn:
yarn add obsidian-daily-notes-interface
```## Utilities
### createDailyNote
Replicates the Daily Notes plugin in Obsidian but allows creating a note for any day (past or present).
#### Usage
```ts
import { createDailyNote } from 'obsidian-daily-notes-interface';
...
const date = moment();
createDailyNote(date);
```> Note: if you pass in a past or future date, {{date}} tokens in the user's daily notes template will resolve to the correct date.
### appHasDailyNotesPluginLoaded
Check if the user has the Daily Notes plugin enabled.
### getAllDailyNotes
Returns a map of all daily notes, keyed off by their `dateUID`.
### getDailyNote
Returns the Daily Note for a given `Moment`. For performance reasons, this requires passing in the collection of all daily notes.
### getDailyNoteSettings
Returns the settings stored in the Daily Notes plugin (`format`, `folder`, and `template`).
### getTemplateInfo
Generic utility for reading the contents of a file given it's relative path. This does not apply any transformations.
## FAQ
### What is a `dateUID`?
A `dateUID` uniquely identifies a note, allowing for faster note lookup. It is prefixed by a granularity: `day`, `week`, `month` to allow for additional supporting additional note types (the Calendar plugin uses this for Weekly Notes currently).
### Why do I have to pass in the a map of daily notes to `getDailyNote()`?
This allows you to cache the collection of dailyNotes for a significant speed up.
## Sponsors 🙏
A big thank you to everyone that has sponsored this project.
- [Carlo Zottman](https://github.com/czottmann), creator of [Actions for Obsidian](https://actions.work/actions-for-obsidian)
- [Brian Grohe](https://github.com/paxnovem)
- [Ben Hong](https://github.com/bencodezen)