Add line comment syntax (%% to end of line)#384
Open
dereuromark wants to merge 1 commit into
Open
Conversation
Introduces a dedicated line comment syntax that extends from `%%` to the end of the line. This addresses the limitations of attribute-based comments discussed in jgm#67: - Visually obvious what is commented out, even without highlighting - Works uniformly in inline and block contexts - No issues with blank lines breaking multi-line comments - Follows established pattern from LaTeX The existing attribute comment syntax (`{% ... %}`) is preserved for adding comments within attributes. Refs jgm#67
dereuromark
added a commit
to php-collective/djot-php
that referenced
this pull request
Mar 16, 2026
Implements line comments that start with `%%` and extend to end of line:
- Inline: `Text before %% this is ignored`
- Full line: `%% This entire line is a comment`
Implementation:
- InlineParser: strips `%%` to end of line before parsing inline content
- BlockParser: handles full-line comments (lines starting with `%%`)
The existing comment syntaxes (`{% ... %}` and `%%%` fenced) are preserved.
Refs jgm/djot#67, jgm/djot#384
This was referenced Mar 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Introduces a dedicated line comment syntax:
%%extends to the end of the line and is ignored.To comment out multiple lines, mark each line:
Motivation
Addresses the limitations of attribute-based comments discussed in #67:
The existing attribute comment syntax (
{% ... %}) is preserved for adding comments within attributes.Changes
doc/syntax.md: Added "Line comments" subsection under Comment, reorganized existing attribute comment docsdoc/cheatsheet.md: Updated comment examples to show both stylesRefs #67