Skip to content

christopherkenny/wordcount

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Word Count Extension For Quarto

This extension inserts word counts into Quarto documents in the place of {{wordcount}}. Word counts can be inserted in the body or metadata (YAML header) of a document. To include the number of words in the references, use {{wordcountref}}.

You may also be interested in:

Installing

quarto add christopherkenny/wordcount

This will install the extension under the _extensions subdirectory. If you're using version control, you will want to check in this directory.

Using

After installing:

  • Add
    filters:
      - wordcount
    to the YAML header of your Quarto file
  • Add {{wordcount}} or {{wordcountref}} in your document (without the `tics`). Make sure there are spaces around it.

For example you could write:

There are {{wordcount}} words in this document.

and it will replace {{wordcount}} with its estimate.

You can also include additional settings like the following to control whether inline code is counted in the word total:

filters:
  - wordcount
wordcount:
  count-code-blocks: false
  count-inline-code: false

When true:

  • r 2+2 increases the count by 2.
  • r 2 + 2 increases the count by 4.

When set to false, inline code does not contribute to the word count.

Example

Here is the source code for a minimal example: example.qmd.

example.qmd

Licensing

The original wordcount filter is licensed under a MIT license to 2017-2021 pandoc Lua filters contributors. This Quarto extension is also licensed under the MIT license.

About

Word Count Extension For Quarto with {{wordcount}}

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages