Skip to content

Comments configuration#32

Open
Vladyslav-Kuksiuk wants to merge 28 commits into
masterfrom
comments-configuration
Open

Comments configuration#32
Vladyslav-Kuksiuk wants to merge 28 commits into
masterfrom
comments-configuration

Conversation

@Vladyslav-Kuksiuk
Copy link
Copy Markdown
Collaborator

@Vladyslav-Kuksiuk Vladyslav-Kuksiuk commented May 18, 2026

This PR provides comments filtration option.

How to use

Add the comments parameter to the embed-code tag.

<embed-code
  file="myFile.java"
  comments="none" />
```java
```

Supported values

  • all — retain all comments. This is the default.
  • none — strip all recognized comments.
  • documentation — retain documentation comments such as Javadoc, KDoc etc.
  • regular — retain regular comments, including block and inline comments, but strip documentation comments.
  • inline — retain regular inline comments such as //.
  • block — retain regular block comments such as /* */.

Not every mode has a distinct meaning for every supported file type.
For example, XML, HTML, and YAML support only all and none.

Supported formats

Comment filtering is supported for:

  • Java, Kotlin, KTS, Groovy
  • C, C++, C#
  • JavaScript, TypeScript
  • YAML
  • XML, HTML
  • Visual Basic
  • Python
  • Go
  • Protobuf

Unsupported file types are left unchanged, and a warning is emitted when comment filtering other than all is requested.

Resolves this issue.

Additional changes

  • Improved multiple errors output:
image
  • Updated check mode "outdated" output and throw error on it:
image

@Vladyslav-Kuksiuk Vladyslav-Kuksiuk self-assigned this May 18, 2026
@alexander-yevsyukov
Copy link
Copy Markdown
Contributor

documentation — retain documentation comments such as Javadoc, KDoc.

This parameter should be treated in context of the embedded file and depend on the type of the programming language of the embedded file. Javadoc, and KDoc are only two formats that use the same convention for the comments (/** */).

For other programming languages that we use (Go, Python, JavaScript, TypeScript, etc.) we should treat comments according to the language contentions.

For some file formats, the documentation parameter should not be applicable and should cause an error. For example, there's nothing documentation in a Markdown or .properties file.

Please have a look around of the file types we use in our projects and use them for sensible defaults.

@Vladyslav-Kuksiuk Vladyslav-Kuksiuk marked this pull request as ready for review May 20, 2026 11:02
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.

Support comments parameter

2 participants