๐Ÿ™ Word & Character Count?

Hello,

Good afternoon everyone (UK time)

I really would love to have word, character and even reading time available.

Has anyone working on this or has any bits of code I can try out?

Any help would be great (I am not code-savvy by the way)

thank you

Kane

Hi @KaneDodgson, we are currently working on a plugin system and I think โ€œword countโ€ is a good candidate for a testing plugin. We may try to build one to test the plugin systemโ€™s capabilities.

@Charlie What do you think?

5 Likes

That would be brilliant, even a simple basic word count would be helpful to me, to begin with. Loving this product. Ideally, word and character would be good. then if possible selective word count (highlight a block or blocks and see its word count) in an ideal world an estimated reading time also

I write a lot of funding bids for my projects and other similar things and they always insist on character counts. Now it is not so much of a problem as I screen everything through Grammarly and this has all those bells and whistles. But having it in the note app would stop me overwriting these kinds of things in the first place.

Thanks for getting back to me on this, appreciated

Kane

Definitely happy to try out as plugin and feedback

2 Likes

Liking this idea a lot Kane. A nice and simple wordcount is always helpful. Would be cool to then also have a count based on selection type view too.

p.s - I have changed this to Feature Request just so that the team can keep track and we can push up the votes :slight_smile:

1 Like

that would be brilliant. thank you

maybe like itโ€™s done in Roam โ€“ putting {wordcount} on top, counting the words in all blocks that are nested under it?

A block function that gives back the number of words / characters in all the blocks nested underneath (like in roam research).

Helps a lot in writing, adding it as a block function would enable to separately count the words in every paragraph also. Could be (optionally) omitted at export.

You can add a Wordcounter for each block or all the text, with the possibility of invoke it with /wordcount.

+1 for this.

My work involves either producing essays to a precise word limit and also producing sermons which need to last for a given time (which I can quickly estimate with word count). At the moment Iโ€™m exporting to Word using Pandoc and counting there for an accurate count.

Iโ€™ve found a Chrome extension โ€œWord Counter Plusโ€ which gives a rough estmate which helps for now, but it breaks flow to have to select text then use the extension.

Thanks for an amazing product!

Hi! Iโ€™ve created a word count plugin that is inspired from Roamโ€™s way of doing it.

Currently you have to manually install it, and it supports an unlimited number of nested blocks.

Hope it helps!

4 Likes

Working great. Much better than the one in Remnote (last time I used it!) that could only be used once per page. Having multiple instances is really powerful, and it works fine in document mode too.

Thank you!

You are most welcome!

Would the team accept a PR that adds a wordcount widget?

There are two approaches Iโ€™m considering, and we could do both or just one. I lean towards both because they achieve slightly different ends, but it might be better to keep it to one to keep the app simpler.

Approach #1

We could build a widget that works like the following example, where this markdownโ€ฆ

- {{wordcount}}
  - this is a bullet with 7 words
  - this bullet has 5 words

โ€ฆ renders something like this:

Approach #2

Alternatively, we could add it to the menu that pops up when you right-click on a block or group of blocks:

Wouldnโ€™t this be better as a plugin? A while ago one of the devs mentioned they would prefer more functionality in plugins, which sounds reasonable: the smaller the code base, the easier it is to keep stable.

As far as the approaches go, I would prefer the first one, I never want word count, unless I specifically want it. The menu is filled with lots of stuff already, adding something you donโ€™t need that often is just bloat.

Despite the negative tone of the previous comment, a word count widget would be really useful.

PS But anybody who collects Dune quotes gets a pass in my book :wink:

1 Like

Good question! I must admit, I hadnโ€™t considered that.

I havenโ€™t written a Logseq plugin before (Iโ€™ve only made contributions to the core) so I donโ€™t have a good sense of what their abilities/limitations are.

How are you envisioning that would work?


Also I agree, wordcount doesnโ€™t feel important enough to warrant stuffing it in the main right-click menu.

How are you envisioning that would work?

What I would use it for, is seeing the word count for a block, or group of blocks, and adding it would be done with /wordcount (like TankCool/logseq-toolbox: Some useful tiny tools for logseq. does with toolbox-daily-quote).

But thinking about it, Logseq has a lot of meta-data in between text, so a really good word count plugin would be able to filter those out. Also embedded blocks, should they be counted or not? Honestly no idea if a plugin even has access to that information.

Plugin Dev Resources

Imho the samples are the easiest to understand:

See also: discord link, about custom.js and what it can do, and a plugin cannot.

1 Like

Thank you for the pointers! Iโ€™d been meaning to check out the plugin stuff for a while, so this is really helpful.


Youโ€™re right, weโ€™ll definitely need to be careful of that when implementing this feature. Good call out!


I thought on it some more, and I think word count is a standard enough feature that it should be in the core. We should err on the side of plugins for most things in order to keep the core small, but I think most people would expect word count to be baked in.

Iโ€™ll let the core team make the final call though! @tienson what do you think?