Publishers set a word count limit you have to meet in writing a manuscirpt. I am trying to write up the manuscript using markdown in emacs. Consider the example below.
MWE
# Results {-}
## Topic 1 {-}
This is just a random text with a citation in markdown \@ref(fig:pca-scree)).
Below is a code block.
```
{r pca-scree, echo = FALSE, fig.align = "left", out.width = "80%", fig.cap = "Scree plot with parallel analysis using simulated data of 100 iterations (red line) suggests retaining only the first 2 components. Observed dimensions with their eigenvalues are shown in green."}
knitr::include_graphics("./plots/PCA_scree_parallel_analysis.png")
```
## Topic 2 {-}
<!-- todo: a comment that needs to be avoided by word count hopefully-->
So when I hit M-x count-words it shows 88 words but when I select the text region only and hit M-= I get 20 words including the undesired \@ref(fig:pca-scree))
which by itself was considered 4 words!
How to do word counting right and text only the emacs way?
Edebug Marko
pandoc-count-buffer
[2 times]
Result: 1 (#o1, #x1, ?\C-a)
[2 times]
Result: 2037 (#o3765, #x7f5)
/bin/bash: line 1: marko: command not found
Result: 127 (#o177, #x7f, ?\C-?)
[3 times]
Result: "*Shell Command Output*"
[3 times]
Result: 1 (#o1, #x1, ?\C-a)
[2 times]
Result: 45 (#o55, #x2d, ?-)
Result: (html nil (body nil (p nil "/bin/bash: line 1: marko: command not found\n")))
Result: (html nil (body nil (p nil "/bin/bash: line 1: marko: command not found\n")))
[4 times]
Result: +
[3 times]
Result: (html nil (body nil (p nil "/bin/bash: line 1: marko: command not found\n")))
Result: ((p nil "/bin/bash: line 1: marko: command not found\n"))
[4 times]
Result: (p nil "/bin/bash: line 1: marko: command not found\n")
Result: "/bin/bash: line 1: marko: command not found\n"
Result: ("/bin/bash:" "line" "1:" "marko:" "command" "not" "found")
Result: 7 (#o7, #x7, ?\C-g)
Result: (7)
Update
This post has a follow up question here.