Incorrect word count when there are weird HTML comments in the source
// Please enter a detailed description of the issue // Description of the issue:
If I open the attached file in Marked 2, it displays a word count at the bottom of the window "10 words". But only 5 words are visible – the rest are hidden by the (admittedly unusual) HTML comment in the source.
I've attached a screenshot of what Marked looks like with this document open.
// Please enter a list of steps required to reproduce the issue // Steps to reproduce:
- Open the attached document.
- Look at the word count from Marked 2.
- Count the words with your eyes.
This is a reduced example from a larger document, when the word count was misreported by almost 800 words due to commented-out parts.
This is definitely a bit of a weird HTML comment (two opening <!--) – I'm not sure if this is well-defined behaviour in the HTML spec, but if Marked is going to exclude these words from the output, it feels like they should also be excluded from the word count.
// If applicable please attach a sample document that causes the issue for you.
// Configuration (do not edit) Marked 2 1016 (Direct)
macOS Version: 10.15.7
additionalMathJaxConfig:
allowPageBreakInCode: YES
bookTxtIsLeanpub: NO
summaryMdIsGitBook: NO
codeIsPoetry: NO
codeCanWrap: YES
collapsibleHeadlines: NO
convertGithubCheckboxes: YES
convertGithubEmoji: YES
convertYAMLToMMD: NO
defaultMathJaxConfig: TeX-AMS-MML_HTMLorMML
defaultPreviewStyle: 3
defaultProcessor: MultiMarkdown
enableMiniMap: NO
excludeBlockQuotesFromCounts: NO
excludeFootnotesFromCounts: NO
excludeVerbatimFromCounts: NO
excludeCaptionsFromCounts: NO
folderPreviewExtensionsArray: md, markdown, txt, mdown, html, opml
githubNewlines: NO
h1IsPageBreak: NO
h2IsPageBreak: NO
hrIsPageBreak: NO
includeMathJax: NO
includeKatex: NO
limitTextWidth: NO
mathNumberEquations: NO
mathNumberEquationsSide: 0
mathNumberEquationsAMSOnly: NO
minimalJavaScript: NO
outlineModeExtensions:
permissionGranted: NO
printHeaderBottomLeft:
printHeaderBottomRight:
printHeaderFirstPage: NO
printFooterFirstPage: NO
printHeaderTopLeft:
printHeaderTopRight:
processHTMLFiles: YES
removeMetadataForPreview: NO
removeYAMLHeaders: NO
scrollToEdit: YES
shouldDetectCritic: YES
shouldHighlightMarkupErrors: NO
shouldLoadCritic: NO
syntaxHighlight: YES
syntaxHighlightOnlyLang: NO
useCustomMarkdownProcessor: NO
customMarkdownProcessor:
useCustomPreprocessor: NO
customPreprocessor:
useFirstH1AsPrintTitle: YES
- marked_word_count.md 64 Bytes
-
Screenshot_2021-04-12_at_23.43.40.png 453 KB
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
Support Staff 1 Posted by Brett on 13 Apr, 2021 10:49 AM
Interestingly it's not the double opening syntax that throw it off, it's
the extra right angle bracket. If I remove that, it still gets the word
count right, even with the `<!--` in there. I should be able to fix
this.
-Brett
Support Staff 2 Posted by Brett on 13 Apr, 2021 11:05 AM
Yep, I have this fixed for the next update. Thanks for the detailed
report.
-Brett