Skip to content

Add fenced comment block support (%%%)#124

Open
dereuromark wants to merge 1 commit into
jgm:mainfrom
dereuromark:fenced-comment-blocks
Open

Add fenced comment block support (%%%)#124
dereuromark wants to merge 1 commit into
jgm:mainfrom
dereuromark:fenced-comment-blocks

Conversation

@dereuromark
Copy link
Copy Markdown
Contributor

Summary

  • Adds fenced comment block syntax using %%% (3+ percent signs) as delimiters
  • Content between fences is completely discarded (not rendered)
  • Closing fence must have at least as many % as the opening fence
  • Unlike inline comments ({% %}), fenced comment blocks can contain blank lines
  • Unclosed comment blocks consume the rest of the document
Before.

%%%
This comment can contain

blank lines and is fully discarded.
%%%

After.

<p>Before.</p><p>After.</p>

Companion spec PR: jgm/djot#376

A reference implementation exists in djot-php.

Add block-level comment syntax using three or more percent signs as
fenced delimiters. Content between the fences is completely discarded
and does not appear in the rendered output.

Unlike inline comments ({% %}), fenced comment blocks can contain
blank lines, making them suitable for commenting out larger sections.

- Add fenced_comment block spec in block.ts with fence matching
- Add +comment/-comment event handlers in parse.ts that discard content
- Add test cases covering basic usage, blank lines, longer fences,
  fence length matching, and unclosed comments

Companion spec PR: jgm/djot#376
@jgm
Copy link
Copy Markdown
Owner

jgm commented Mar 16, 2026

I'm not sold yet on fenced comment blocks.

@dereuromark
Copy link
Copy Markdown
Contributor Author

https://php-collective.github.io/djot-php/guide/syntax.html#comments

Here is an overview of the different kind, and why it is useful and probably important to allow such multi line ones incl newlines for visual separation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants