Word count includes HTML-commented-out regions

Paul Jacobs's Avatar

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

additionalMathJaxConfig:
allowPageBreakInCode: NO
bookTxtIsLeanpub: NO
summaryMdIsGitBook: NO
codeIsPoetry: NO
codeCanWrap: YES
collapsibleHeadlines: 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
printHeaderBottomLeft:
printHeaderBottomRight:
printHeaderFirstPage: NO
printFooterFirstPage: NO
printHeaderTopLeft:
printHeaderTopRight:
processHTMLFiles: YES
removeMetadataForPreview: NO
removeYAMLHeaders: NO
scrollToEdit: YES
shouldDetectCritic: YES
shouldHighlightMarkupErrors: YES
shouldLoadCritic: NO
syntaxHighlight: YES
syntaxHighlightOnlyLang: YES
useCustomMarkdownProcessor: NO
customMarkdownProcessor:
useCustomPreprocessor: NO
customPreprocessor:
useFirstH1AsPrintTitle: YES

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

    Brett's Avatar

    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 2 Posted by Brett on 08 May, 2019 09:32 PM

    Brett's Avatar

    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. 3 Posted by Paul Jacobs on 09 May, 2019 05:26 AM

    Paul Jacobs's Avatar

    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 4 Posted by Brett on 09 May, 2019 10:32 AM

    Brett's Avatar

    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. 5 Posted by Paul Jacobs on 09 May, 2019 02:01 PM

    Paul Jacobs's Avatar

    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 6 Posted by Brett on 09 May, 2019 02:15 PM

    Brett's Avatar

    Just for the record, using a direct download of your file:

    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. 7 Posted by Paul Jacobs on 10 May, 2019 04:47 AM

    Paul Jacobs's Avatar

    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. 8 Posted by Paul Jacobs on 10 May, 2019 01:07 PM

    Paul Jacobs's Avatar

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

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

    Brett's Avatar

    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. 10 Posted by Paul Jacobs on 13 May, 2019 06:11 AM

    Paul Jacobs's Avatar

    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.

Reply to this discussion

Internal reply

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

Attaching KB article:

»

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
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac