lukeleppan/better-word-count

Plugin count comments although in the options it is indicated not to do it

Opened this issue · 11 comments

Hi, it seems plugin count comments although in the options it is indicated not to do it

I've just experienced the same issue.

SCR-20230404-jmta

#61 was closed but seems like it is the seem recurrent issue.

Yes, I also see comments (wrapped by %% ... %%) are still being counted

I'm experiencing the same issue as of 2023-06-21. Hoping for a fix (plus a feature to exclude metadata in counting).

This has been fixed in v0.10.0

Thanks @mgmeyers... I guess would be important a feature to exclude metadata in counting too: there are very frequent cases in which you have to write texts with character limits and frontmatter should be excluded by default.

hsandt commented

I confirm fix for comments. We should close this issue then.

If you need to exclude more things you can add details to #84

I am still seeing this bug in 0.10.0.

skztr commented

I'm seeing what I believe to be a related bug:

  1. I am often seeing comments counted in total counts
  2. when I have comments within a section, I am sometimes seeing completely wrong counts eg: a 19-word comment results in a 447-word file reporting as only 71-words long / the 146-word section containing the comment (after leaving and re-entering the file) reporting as having only 39 words in it - this incorrect section count persists even after I remove the comment, until I have significantly altered the section (or leave / re-enter the file)

Looks like this is still counting comments in the API. My counts via the API are different from the status bar. API seems to also count all frontmatter. A fresh note with frontmatter and comments should be a zero count.

---
front:
matter:
stuff:
---
%%
Comments
%%

I am using the getWordCountPagePath() method in dataviewjs.

V0.10.1

It's partial, maybe someone mixed up which "comments" are counted and omitted?

What works correctly in V0.10.1

<!---
HTML Comments
-->
%% There are Comments between two Double Percents
   Allows multi-line and/or in-line
%%
$% [[Another Comment that works]]$
  %% Comment
%%%% Multi-line
%%%% Excessive
%%

What does not work as expected in V0.10.1

%% Not counted
%% Counted, because multi-line depends on Obsidian? I swear I thought this one worked in the past?
```
# Codeblock Comments
```
[comment]: <> (Markdown Comment, universally compatible)
[//]: <> (Markdown Comment, alternative.)
[//]: # (Markdown Comment, compact)

Conclusion:

Some ways work, some don't. I think it depends on Obsidian and not the plugin on what's recognized and what isn't counted or omitted. Unless you are using a particular commenting method specific for a reason, which I seriously doubt, just change how you write comments, there are three normal options, and the one that goes between %% and %% seems like the easiest to type and forget.