# Word count includes HTML-commented-out regions

#### Paul Jacobs

07 May, 2019 11:16 AM

// Please enter a detailed description of the issue // Description of the issue: The word count displays the number of words in the source material, not that rendered.

// Please enter a list of steps required to reproduce the issue // Steps to reproduce:

1. Using any md file, note the word count.
2. Comment out a section using HTML comment tags (<!-- like this -->)
3. Check the word count again.

// If applicable please attach a sample document that causes the issue for you.

// Configuration (do not edit) Marked 2 974 (Mac App Store)

## macOS Version: 10.14.4

allowPageBreakInCode: NO
bookTxtIsLeanpub: NO
summaryMdIsGitBook: NO
codeIsPoetry: NO
codeCanWrap: YES
convertGithubCheckboxes: YES
convertYAMLToMMD: NO
defaultMathJaxConfig: TeX-AMS-MML_HTMLorMML
defaultPreviewStyle: 2
defaultProcessor: MultiMarkdown
enableMiniMap: NO
excludeBlockQuotesFromCounts: YES
excludeFootnotesFromCounts: YES
excludeVerbatimFromCounts: YES
excludeCaptionsFromCounts: YES
folderPreviewExtensionsArray: md, markdown, txt, mdown, html, opml
githubNewlines: YES
h1IsPageBreak: NO
h2IsPageBreak: NO
hrIsPageBreak: NO
includeMathJax: NO
includeKatex: NO
limitTextWidth: NO
minimalJavaScript: YES
outlineModeExtensions:
permissionGranted: NO
printFooterFirstPage: NO
processHTMLFiles: YES
scrollToEdit: YES
shouldDetectCritic: YES
shouldHighlightMarkupErrors: YES
syntaxHighlight: YES
syntaxHighlightOnlyLang: YES
useCustomMarkdownProcessor: NO
customMarkdownProcessor:
useCustomPreprocessor: NO
customPreprocessor:
useFirstH1AsPrintTitle: YES

1. Support Staff Posted by Brett on 08 May, 2019 03:56 PM

Hi Paul,

This definitely shouldn't be happening, I'll look into it for the next
update. Thanks for the report.

-Brett

2. Support Staff Posted by Brett on 08 May, 2019 09:32 PM

I'm doing some testing and not seeing this happen at all. Word count in the bottom bar appropriately updates whenever I comment anything out. Can you attach an example file with some text commented out that shouldn't be counted? I'll uncomment and see if the count changes, I just want to see if you're doing something I'm not expecting when I parse the formatting.

3. Posted by Paul Jacobs on 09 May, 2019 05:26 AM

Hi Brett

Attached are the document which shows the effect, and some screen shots, with commented in/out region (beginning with 'Security researchers').
Note: Changing style or using floating stats shows the same numbers. Adding a word to a commented out region does affect the word count (I added 'ONE' for that purpose.)
I have been using Marked2 for years but only recently realised what I could do with embedding HTML, and in this document, started using it for commenting in/out bits of content.
Thanks

Paul

4. Support Staff Posted by Brett on 09 May, 2019 10:32 AM

This is a bit baffling. I tested with your file and was unable to
reproduce the issue at all. Editing within the comment didn't change the
word count at all, nor did completely removing the comment. Uncommenting
it changes the word count to include all of the comment's content.
Everything working as I would expect.

I wonder if a counter is getting stuck. Try this for me: open the
commented file and get the word count from the bottom of the preview.
Quit Marked. Edit the file to uncomment at least one section. Launch
Marked (re-open the file if necessary). Does the word count change
appropriately?

-Brett

5. Posted by Paul Jacobs on 09 May, 2019 02:01 PM

Yes, bizarre. I tried your suggestion, closing (quitting) Marked between edits. Same counts (1396 words) although the char count changes by 3.
I commented everything out except two added words. Word count remains the same at 1396+2.
I have been in Emacs for the past few months, so tried TextMate's 'remove unprintable chars'--no change.
TextMate2's MD preview doesn't seem to honour HTML comments but SublimeText3 'MarkdownLivePreview' package does.
There are obviously external dependencies causing the difference. I have lots of brew and macport-installed stuff for LaTeX processing, pandoc, etc., so if anything like that could be the issue, I'll dig deeper.

6. Support Staff Posted by Brett on 09 May, 2019 02:15 PM

Are you using a custom processor, and if so, can you share the executable path and argument fields with me? Also, and possibly more to the point, can you do a view source (⌘U) and show me (just a screenshot) what the markup looks like?

7. Posted by Paul Jacobs on 10 May, 2019 04:47 AM

Hi Brett
Attached a new set of screen shots showing that inline comments work, at least on one line. Adding a newline anywhere within breaks the word count.
AFAIK I have no custom processor, and there is nothing in the 'Help->Show custom processor log'.
Thanks

8. Posted by Paul Jacobs on 10 May, 2019 01:07 PM

For completeness, a richer view of inline and newline HTML commented regions in Marked HTML view.

9. Support Staff Posted by Brett on 10 May, 2019 07:44 PM

This is utterly baffling. No matter what I try I can't get this bug to happen on my end and I don't know what else I need to ask to figure out what's different for you. I'm going to have to continue looking into it, but I've got some top priority fixes that will need to come first. I'll keep this ticket open and let you know if I'm able to solve anything!

10. Posted by Paul Jacobs on 13 May, 2019 06:11 AM

I wiped a 2011 MBA back to the latest factory OS it will support (10.13.6) and reinstalled Marked2 from the AppStore. Both issues are gone (commenting out/Cmd-O).
So, it's something on my MBP. I will go through it, uninstalling suspects, and then do a factory reset. If I find a culprit along the way, I'll update you.

11. Posted by Paul Jacobs on 30 May, 2019 12:54 PM

Another observation that might give some clues. Bracketing words with chevrons affects the word count.

one two three
<
four five six
>


The word count is 3. Delete either of the angle brackets and the word count is correct.

12. Support Staff Posted by Brett on 30 May, 2019 01:20 PM

Your angle brackets are creating html-valid tags, which are always excluded from word count. I believe this is separate from the HTML comments issue.

- Brett

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

### »

#### Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

# Keyboard shortcuts

### Generic

? Show this help Blurs the current field

### Comment Form

r Focus the comment reply box Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

## Recent Discussions

 13 Feb, 2020 09:22 PM Markdown Formatting 11 Feb, 2020 11:53 AM Custom themes not working 10 Feb, 2020 06:48 PM KaTex Preview Update 06 Feb, 2020 04:32 PM Using mermaid in Marked 2 29 Jan, 2020 12:45 AM MathJax rendering errors - Scrivener

## Recent Articles

 Using JavaScript in Marked Custom CSS: Writing custom CSS for Marked License code has already been utilized Highlight sentences longer than a certain number of words How do I retrieve a lost license (direct version)