isaaclyman / novel-word-count-obsidian

Obsidian plugin. Displays a word count or other statistic for each file, folder and vault in the File Explorer pane.
https://obsidian.md/plugins?id=novel-word-count
MIT License
85 stars 8 forks source link

Store counts in properties #97

Closed mmarschall closed 1 month ago

mmarschall commented 1 month ago

I would love to query the counts with DataView.

One way to enable that would be to store the counts in properties in the files.

Most probably this would require a setting to decide whether or not the counts, which are selected to be shown in the file explorer, should be stored as properties and maybe even enable the user to decide on the property name.

isaaclyman commented 1 month ago

Editing vault files is strictly off limits for this plugin - see the "Safety" section of the README. That's a level of risk I'm not interested in taking on, and I think most users prefer the assurance that the plugin isn't messing with anything.

However, all counts are stored in the plugin's data.json file, so perhaps it's possible to retrieve them from there somehow?

mmarschall commented 1 month ago

There is a plugin called Frontmatter Generator. It can dynamically access objects in Obsidian and update properties. In addition to the data.json file, is there a way to dynamically query the data similar to something like this: folder: file.parent.path? Or how could I read from the data.json file? Then I might be able to use the Frontmatter Generator to achieve what I need. Thanks a lot! I really appreciate your plugin and your help!

isaaclyman commented 1 month ago

I haven't read the code of Frontmatter Generator, but it looks like it uses the file metadata from Obsidian, so I wouldn't expect it to know about data.json.

I don't really know how to solve that problem without a custom script or plugin.