Zettelkasten Forum


<!-- --> How to use this

edited November 2021 in The Archive

I'm not a coder, but I'd like to able to "comment out" sections of a file (like a part of a video script I decided not to use but don't want to delete).

I see that I can open with !-- and close with -- in The Archive. I read somewhere that sometimes markdown wants three dashes at the beginning. What say you?

If I want to comment out a paragraph, is this a good way to do it?

!-- THIS PART SUCKS
Here is a bad paragraph.
Blah blah blah. --

EDIT: I had to remove the "<" and ">" because it commented out most of my post 😂

Comments

  • To clarify, is this image the way to do it?

  • @joegilder Great question; I'm interested in learning the answer as well :smile:

  • Yeah, that's how it works :)

    Some editors don't recognize multi-line comments, only in-line, so if you have line breaks in e.g. block like this:

    <!-- start
    
    middle
    
    end
    -->
    

    ... then some editors will not show a different color for the block.

    But the relevant Markdown tools to transform Markdown into HTML, PDF, LaTeX etc. usually do. Editors often just have trouble with syntax highlighting for this. (It's not as easy as it looks, I can say from experience ;))


    @Sascha and I comment in article and book drafts extensively to collaborate. It's super useful, also to leave reminders to your future self when you write longer pieces.

    Author at Zettelkasten.de • https://christiantietze.de/

  • That's helpful, Thanks @ctietze

    I couldn't remember how to do code. Silly me.

  • I notice (and found this by accident) that if I bracket lines with ---, the lines do not appear when I preview them. For example, if I type:

    ---
    Line 1  
    Line 2  
    Line 3
    ---
    

    The three lines and the enclosing --- do not appear in a preview.

    Is this expected behaviour?

  • One issue I ran into is that when I type two short dashes in a row, The Archive wants to turn those into one long dash, which messes up how the characters are interpreted in Markdown. Or maybe it is the Mac OS that is doing the conversion?

  • Try escaping with a backslash, somewhere. Example:

    <!--

    No comment.

    -->

    Was rendered with

    <\!--

    No comment.

    \-->

    GitHub. Erdős #2. CC BY-SA 4.0. Problems worthy of attack / prove their worth by hitting back. -- Piet Hein. Armchair theorists unite, you have nothing to lose but your meetings! --Phil Edwards

  • @GeoEng51, this is a feature of macOS.

    The "one long dash" is called an em dash, a typeface term for a longer en dash. The em dash is useful as a punctuation mark in some writing genera. You can turn this on or off by application in the "Edit -->Subsitutions" menu.

    Will Simpson
    I must keep doing my best even though I'm a failure. My peak cognition is behind me. One day soon I will read my last book, write my last note, eat my last meal, and kiss my sweetie for the last time.
    kestrelcreek.com

  • @DavidWJ said:
    I notice (and found this by accident) that if I bracket lines with ---, the lines do not appear when I preview them. For example, if I type:

    ---
    Line 1  
    Line 2  
    Line 3
    ---
    

    The three lines and the enclosing --- do not appear in a preview.

    Is this expected behaviour?

    Yes. Three dashes are markdown for page break.

    The following line


    was created by the three dashes "---"

    I am a Zettler

  • @DavidWJ Depending on what you use for preview, this could also be interpreted as a metadata block, but that's usually only supposed to work at the beginning of a document.

    Author at Zettelkasten.de • https://christiantietze.de/

  • Thank you all.

Sign In or Register to comment.