Merge branch 'hotfix/0.7.7'

This commit is contained in:
Luke Leppan 2021-07-17 16:17:46 +02:00
commit f6fd30c385
4 changed files with 18 additions and 10 deletions

View file

@ -1,4 +1,4 @@
## Better Word Count
# Better Word Count
![GitHub Workflow Status](https://img.shields.io/github/workflow/status/lukeleppan/better-word-count/Build%20Release?logo=github&style=for-the-badge) ![GitHub release (latest by date)](https://img.shields.io/github/v/release/lukeleppan/better-word-count?style=for-the-badge) ![GitHub All Releases](https://img.shields.io/github/downloads/lukeleppan/better-word-count/total?style=for-the-badge)
@ -6,7 +6,7 @@ This plugin is the same as the built-in **Word Count** plugin, except when you s
![Better Count Word](https://raw.githubusercontent.com/lukeleppan/better-word-count/master/assets/better-word-count.gif)
### Features
## Features
- Allows you to store statistics about your vault.
- Works with all languages.
@ -17,16 +17,18 @@ This plugin is the same as the built-in **Word Count** plugin, except when you s
- Total Files in vault.
- Highly Customizable status bar that can be adapted to your needs.
#### TODO:
### TODO
- [ ] add statistic view
- [ ] add more statistics (make suggestions)
- [ ] add goals
### Contributors
## Contributors
- @leoccyao
- Added all word, char, sentence count when not viewing a markdown file.
- @lishid
- Helped solve the performace issue.
### Special Thanks

View file

@ -1,7 +1,7 @@
{
"id": "better-word-count",
"name": "Better Word Count",
"version": "0.7.6",
"version": "0.7.7",
"description": "Counts the words of selected text in the editor.",
"author": "Luke Leppan",
"authorUrl": "https://lukeleppan.com",

View file

@ -1,6 +1,6 @@
{
"name": "better-word-count",
"version": "0.7.6",
"version": "0.7.7",
"description": "Counts the words of selected text in the editor.",
"main": "main.js",
"scripts": {

View file

@ -12,7 +12,7 @@ export class DataCollector {
}
getTotalFileCount() {
return Object.keys(this.metadataCache.resolvedLinks).length;
return this.vault.getMarkdownFiles().length;
}
async getTotalWordCount() {
@ -20,7 +20,9 @@ export class DataCollector {
const files = this.vault.getFiles();
for (const i in files) {
const file = files[i];
words += getWordCount(await this.vault.cachedRead(file));
if (file.extension === "md") {
words += getWordCount(await this.vault.cachedRead(file));
}
}
return words;
@ -31,7 +33,9 @@ export class DataCollector {
const files = this.vault.getFiles();
for (const i in files) {
const file = files[i];
characters += getCharacterCount(await this.vault.cachedRead(file));
if (file.extension === "md") {
characters += getCharacterCount(await this.vault.cachedRead(file));
}
}
return characters;
@ -42,7 +46,9 @@ export class DataCollector {
const files = this.vault.getFiles();
for (const i in files) {
const file = files[i];
sentence += getSentenceCount(await this.vault.cachedRead(file));
if (file.extension === "md") {
sentence += getSentenceCount(await this.vault.cachedRead(file));
}
}
return sentence;