Code blocks and HTML comments

Bill Smargiassi's Avatar

Bill Smargiassi

04 Jun, 2018 05:26 PM

// Please enter a detailed description of the issue // Description of the issue:

Code blocks interfere with HTML comments. Once a code block is commented out, Marked considers the rest of the document as commented out. The attachment displays properly without the comment block.

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

  1. Use HTML comments around a code block.

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

// Configuration (do not edit) Marked 2 950 (Direct)

macOS Version: 10.13.5

additionalMathJaxConfig:
allowPageBreakInCode: TRUE
bookTxtIsLeanpub: TRUE
summaryMdIsGitBook: TRUE
codeIsPoetry: TRUE
codeCanWrap: TRUE
collapsibleHeadlines: TRUE
convertGithubCheckboxes: TRUE
convertYAMLToMMD: TRUE
defaultMathJaxConfig: TeX-AMS-MML_HTMLorMML
defaultPreviewStyle: 102
defaultProcessor: Discount (GFM)
enableMiniMap: TRUE
excludeBlockQuotesFromCounts: TRUE
excludeFootnotesFromCounts: TRUE
excludeVerbatimFromCounts: TRUE
excludeCaptionsFromCounts: TRUE
folderPreviewExtensionsArray: md, markdown, txt, mdown, html, opml
githubNewlines: TRUE
h1IsPageBreak: TRUE
h2IsPageBreak: TRUE
hrIsPageBreak: TRUE
includeMathJax: TRUE
limitTextWidth: TRUE
minimalJavaScript: TRUE
outlineModeExtensions:
permissionGranted: TRUE
printHeaderBottomLeft:
printHeaderBottomRight:
printHeaderFirstPage: TRUE
printFooterFirstPage: TRUE
printHeaderTopLeft:
printHeaderTopRight:
processHTMLFiles: TRUE
removeMetadataForPreview: TRUE
removeYAMLHeaders: TRUE
scrollToEdit: TRUE
shouldDetectCritic: TRUE
shouldHighlightMarkupErrors: TRUE
shouldLoadCritic: TRUE
syntaxHighlight: TRUE

  1. Support Staff 1 Posted by Brett on 04 Jun, 2018 05:41 PM

    Brett's Avatar

    Hi Bill,

    I can see where it would be useful for this to work, but MultiMarkdown straight from the command line has the same issue with it. Because the comment close gets separated from the opening by the block level code block, it gets converted into HTML entities and thus never seen by the renderer. While I'm aware that GitHub's online parser handles this correctly, it's not something I see putting a lot of time into solving in Marked right now. I'll add it to the list, though. As a workaround, if you put a comment start on the same line as the opening backticks, it will then recognize both start and end tags for the comment.

    <!--
    This text should not appear 
    
    ## H2
    -->
    <!--```
    Mixing in a code block
    ```
    
    -->
    
    This text should appear.
    

    Not ideal, but workable in all Markdown flavors.

  2. 2 Posted by Bill Smargiassi on 04 Jun, 2018 06:17 PM

    Bill Smargiassi's Avatar

    Thanks. You’ve again pointed me in the right direction. I use the “GFM (Discount)” processor, since most of my Markdown targets GFM. I installed Discount 2.2.3a, called it as a custom processor without options, and that renders the sample document properly.

    Bill

Reply to this discussion

Internal reply

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

Attaching KB article:

»

Already uploaded files

  • comment-testing.md 145 Bytes

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