Do not count words in code blocks unless it is a code comment

Use case or problem

Right now I am writing a lengthy computer science document with plenty of python code blocks/snippets. The word count is wildly inaccurate as obsidian counts everything in the code as words. So a_variable_name gets counted as 3 words.

Proposed solution

Instead I believe only code comments should be counted towards total word count. What is a code comment could be derived from the stated syntax highlighting chosen. For example:

```python

This should mean that for python:

# this is a comment
print("And this is not")

Or for rust:

// This is a comment
println!("And this is not");

On the user side there would be an option to exclude all code snippets from counting or only counting words in comments towards the total, or the current behavior of counting everything.

1 Like