Skip to content

[FEATURE] Warn about comments that look like a directive without a space - #1408

Open
linawolf wants to merge 1 commit into
mainfrom
task/warn-directive-without-space
Open

linawolf wants to merge 1 commit into
mainfrom
task/warn-directive-without-space

Conversation

@linawolf

@linawolf linawolf commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

[FEATURE] Warn about comments that look like a directive without a space

A typo like .. confval::passwordPolicies makes the whole block
disappear without any diagnostic: without whitespace after "::" it is no
directive, so it is parsed as a comment and dropped before any node
reaches the theme. The TYPO3 Core API documentation shipped several such
blocks unnoticed: a confval that lost its anchor and inventory entry, a
code block that swallowed the following prose, and index entries that
were never generated.

A comment starting with a name directly followed by "::" and more text
now logs a warning with the corrected spelling. Real comments practically
never start like that. Consecutive comments are consumed as one block,
so each of them is checked.

Signed-off-by: linawolf
Assisted-By: Claude Opus 5.5 (1M context) noreply@anthropic.com

@linawolf
linawolf force-pushed the task/warn-directive-without-space branch from 49db54f to 8e978d9 Compare October 4, 2026 10:41

@jaapio jaapio left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we would wire another log channel rather than app into the rules for these kid of warnings we could create a basic violation framework. Monolog supports log channels.

Another idea could be that we introduce a customized Violations class that we inject into rules or via the parser context. This would allow us to collect validation issues and print them to a separate file. This could also help with my idea on having validation on directives.
Using the context has the benefit of having it always available.

In the first iteration the validation errors and warnings could be simply printed to console using s logger, on a later version we could start adding configuration, and extend this more and more.

How does that sound to you?

A typo like `..  confval::passwordPolicies` makes the whole block
disappear without any diagnostic: without whitespace after "::" it is no
directive, so it is parsed as a comment and dropped before any node
reaches the theme. The TYPO3 Core API documentation shipped several such
blocks unnoticed: a confval that lost its anchor and inventory entry, a
code block that swallowed the following prose, and index entries that
were never generated.

A comment starting with a name directly followed by "::" and more text
now logs a warning with the corrected spelling. Real comments practically
never start like that. Consecutive comments are consumed as one block,
so each of them is checked.

Signed-off-by: linawolf
Assisted-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@linawolf
linawolf force-pushed the task/warn-directive-without-space branch from d579c22 to cbe11c4 Compare October 5, 2026 14:49
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