fletcher / MultiMarkdown-5

Reference implementation of MultiMarkdown; replaces MultiMarkdown v4 (deprecated -- see MMD-6 instead)
https://github.com/fletcher/MultiMarkdown-6
Other
293 stars 46 forks source link

Syntax for comments #12

Closed olivierkes closed 8 years ago

olivierkes commented 8 years ago

Hi, I was wondering if you were open to add a syntax for comments. Comments would be totally ignored by parser. I'm using txt2tags, and i'm so much used to them that it seems difficult to switch to mmd because of that. I know that right know we can use html comments, but it's not very convenient, and they would appear in html source. A simple syntax could be "% " or "# " at the beginning of a line. Regards,

fletcher commented 8 years ago

CriticMarkup already provides a syntax for comments:

{>>This is a comment<<}

http://fletcher.github.io/MultiMarkdown-5/criticmarkup.html

Fletcher

On 3/4/16 1:16 PM, Olivier wrote:

Hi, I was wondering if you were open to add a syntax for comments. Comments would be totally ignored by parser. I'm using txt2tags, and i'm so much used to them that it seems difficult to switch to mmd because of that. I know that right know we can use html comments, but it's not very convenient, and they would appear in html source. A simple syntax could be "% " or "# " at the beginning of a line. Regards,

— Reply to this email directly or view it on GitHub https://github.com/fletcher/MultiMarkdown-5/issues/12.

Fletcher T. Penney fletcher@fletcherpenney.net

olivierkes commented 8 years ago

Not the most convenient syntax to simply comment out a whole line or paragraph, but will do.

jarnowic commented 8 years ago

If you preprocess your input file with gpp, as explained by random determinism, you can define your comments any way you like, among other things...

ickc commented 8 years ago

Under the current mmd syntax, if you want to avoid using CriticsMarkup to comment (because one want to separate coding comment and editing comment), you can do something like:

<!-- \begin{comment}
    [COMMENT GOES HERE]
\end{comment} -->

Because HTML comments are ignored except in LaTeX output (according to the documentation), so using an extra LaTeX comment will guarantee it is a comment in all output formats.

The same tricks can be applied to more complicated situation, like this:

<!-- \begin{comment} -->
{{TOC}}
<!-- \end{comment} -->

which I included in almost all my mmd files, because I want the LaTeX generated TOC when the output is LaTeX, and otherwise let MMD do the work for me (seems like the obvious and reasonable expectation from TOC feature, and is the default behavior in pandoc with --toc args. But in MMD this is the workaround.)

pischky commented 5 years ago

In version 6.4.0 this workd for me when I need to comment out multiple lines:

<div style="display: none">
bla bla 
</div>

The source is included in HTML.