benmarwick / wordcountaddin

Word counts and readability statistics in R markdown documents
Other
337 stars 33 forks source link

Recognize the .Rmarkdown extension #40

Closed jennybc closed 4 years ago

jennybc commented 4 years ago

I just tried to use the addin to count words in a blog post I wrote with extension .Rmarkdown. That's something that comes up in some blogdown/Hugo workflows.

And I got this error:

> wordcountaddin:::text_stats()
Error in text_to_count(filename) : 
  The supplied file has a file extension which is not associated with markdown.
  This function only works with markdown or R markdown files.

Now, it was easy enough to just open the rendered .markdown file and wordcount that. But it seems like you could accept the .Rmarkdown extension.

benmarwick commented 4 years ago

Thanks for letting me know, I agree, we should count words in .Rmarkdown files. I've made an edit and it should recognise .Rmarkdown as a valid input file now.