MCPcopy Index your code
hub / github.com/benjypng/logseq-wordcount-plugin

github.com/benjypng/logseq-wordcount-plugin @2.4.14

Chat with this repo
repository ↗ · DeepWiki ↗ · release 2.4.14 ↗ · + Follow
8 symbols 19 edges 6 files 0 documented · 0%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

[:gift_heart: Sponsor this project on Github or :coffee: Get me a coffee if you like this plugin!

Introduction

Usage

Use /wordcount. It will then count the number of words below this parent block. This supports an unlimited number of nested blocks.

You can use more than 1 word counter in a single page. Just prefix the blocks you would like to count with another /wordcount.

It also supports counting sentences that have both English and Chinese/ Japanese words. E.g. 敏捷的棕色狐狸跳过了懒狗 is a funny phrase returns 16 words.

You can also use /character count to count the number of characters (including spaces) instead of words.

Happy counting!

Styling the wordcount button

You can style the wordcount button using the class .wordcount-btn. Simply add it into your custom.css.

Example:

.wordcount-btn {
    border-color: red;
    font-size: 2em;
}

Customising text in the wordcount button

Go to plugin settings, and make the changes as you like.

Migrating from Roam

Roam uses {{word-count}}. All you need to do is to replace each instance of {{word-count}} with {{renderer :wordcount_abc123}} (abc123 can be any other string you want). You can also a use a terminal command (in MacOS or Linux) to do so. In terminal, navigate to the folder (e.g. pages) and run the following command.

find . -type f -name '*.md' -exec sed -i '' s/word-count/renderer\ :wordcount_abc123/g {} +

Installation

Install from the marketplace.

Credits

pengx17 for his suggestions and Ken Lee for his word counting algorithm.

Core symbols most depended-on inside this repo

mixedWordsFunction
called by 2
src/services/countWords.ts
renderCount
called by 2
src/services/renderCount.ts
getCount
called by 2
src/services/getCount.ts
recurse
called by 2
src/services/getCount.ts
provideStyles
called by 1
src/styles.ts
simpleWordsFunction
called by 1
src/services/countWords.ts
button
called by 1
src/services/renderCount.ts
main
called by 0
src/index.ts

Shape

Function 8

Languages

TypeScript100%

Modules by API surface

src/services/renderCount.ts2 symbols
src/services/getCount.ts2 symbols
src/services/countWords.ts2 symbols
src/styles.ts1 symbols
src/index.ts1 symbols

For agents

$ claude mcp add logseq-wordcount-plugin \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact