Comments

Ducktype provides a syntax for commenting out both single lines and entire ranges of lines.

Notes

  • Comment out a single line by prefixing it with [-].

  • Comment out a block of lines using [-- and --].

  • Block comments cannot be nested, but they may contain line comments.

Examples

Comment out a single line:

This is some text in a paragraph.
[-] This line is commented out and is not parsed.
This is part of the paragraph again.

Comment out a group of lines:

This is some text in a paragraph.
[--
This line is commented out and is not parsed.
This line is also part of the comment.
--]
This is part of the paragraph again.

Block comments cannot be nested, but you can have line comments in block comments:

This is some text in a paragraph.
[--
This line is commented out and is not parsed.
[-] This line comment inside the block comment is OK.
--]
This is part of the paragraph again.

Specification

A line comment is any line that starts with [-], possibly with leading whitespace. The entire line is not parsed.

A block comment starts with a line that starts with [--, possibly with leading whitespace. It ends with a line that contains only --], possibly with leading and trailing whitespace. All lines within a block comment are not parsed.

Comment syntax takes priority over all other syntax except fences. The leading indentation of comments has no effect on the block nesting of the content around them.

Parsers may or may not pass comments through to XML or other exported formats.

© 2019 Shaun McCance
cc-by-sa 3.0 (us)

This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.

As a special exception, the copyright holders give you permission to copy, modify, and distribute the example code contained in this document under the terms of your choosing, without restriction.

Powered by
Mallard