kevboh / longform

A plugin for Obsidian that helps you write and edit novels, screenplays, and other long projects.
Other
610 stars 30 forks source link

[API] Get a Longform project's information (frontmatter data, word count…) #154

Open Lulullia opened 1 year ago

Lulullia commented 1 year ago

Describe the solution you'd like A simple method to get information about a Longform project through the Longform API, like basic frontmatter data (would be a good alternative for #87 ) but also Longform-specific data like word counts, writing sessions, drafts, and any potential data added in the future.

It could either be a single method returning an object with all the data, or one method per data type whichever seems best! Though I'm not sure how it would handle drafts. Additionally, it would maybe make it easier to use if all the method requires is a Longform project name, instead of a full path to the file (but either way using a file path should always be an option since that's what we work with most of the time).

Describe alternatives you've considered Currently to get a Longform project's frontmatter we have to use the Obsidian method processFrontmatter since Longform arrays aren't parsed properly and we can't get them through dataview or obsidian cache. Getting word counts would require manually calculating everything too, not ideal. Same for writing sessions.