atom-wordcount icon indicating copy to clipboard operation
atom-wordcount copied to clipboard

Markdown syntax counted as words

Open halcarleton opened this issue 9 years ago • 7 comments

When using atom-wordcount in a markdown file the markdown syntax is counted as words.

ex.

# This is a Title

This shows a count of 5 words and 17 characters. It should show a count of 4 words and 15 characters.

halcarleton avatar Dec 30 '15 19:12 halcarleton

That is a interesting issue. I'm not sure if this is something which should be handled by this plugin, and if what would be user interface look like? Because technically 4 words and 17 chars is correct. Any thoughts are welcome!

OleMchls avatar Jan 01 '16 20:01 OleMchls

It might be worth using CSS selectors to only get the printable elements. Or maybe use markdown-preview's renderer to get the text after rendering out the markdown syntax?

I have a variation on OP's complaint: I wish the word count would exclude text in <!-- --> comment blocks. I write some reports in markdown and copy-paste the report requirements as a comment, but it is hard to work towards a word count when the comment is part of the total

oychang avatar Feb 25 '16 20:02 oychang

Idea: A regex (initially empty) to match characters / patterns to exclude from the count.

Any implementations / PRs welcome

OleMchls avatar Feb 25 '16 21:02 OleMchls

Regexp applied to .md or .markdown files could work very well for this.

alexdevero avatar Sep 25 '17 07:09 alexdevero

@alexdevero - Is this still an issue in the current version? I believe the current version gives 4 words and 16 characters (spaces get included).

davidlday avatar Sep 09 '18 00:09 davidlday

Came up with the same result as @davidlday: 4 W | 16 C which is not what OP expects and what the number of characters output by markdown processors (which output 15 characters, including whitespaces).

ghost avatar Jan 14 '19 08:01 ghost

I think #99 will address this.

davidlday avatar Jan 17 '19 11:01 davidlday