Skip to content

Added option to remove indent from code samples - #3081

Merged
mnocon merged 3 commits into
5.0from
remove-indent
Mar 31, 2026
Merged

mnocon merged 3 commits into
5.0from
remove-indent

Conversation

@mnocon

@mnocon mnocon commented Mar 11, 2026 •

Copy link
Copy Markdown
Contributor

Target: 4.6, 5.0

Improving readability of the code samples by reducing their indent where it's not meaningful.

It should not be enabled by default, because it can result in wrong indent when a code sample is composed of multiple include_file calls (the indentation would break then).

I've decided to keep the indent for YAML services - it might make things easier when copy/pasting (assuming someone is using 4-spaces indent)

Before:

Screenshot 2026-03-11 at 11 38 57

After:

Screenshot 2026-03-11 at 11 39 03

@github-actions

github-actions Bot commented Mar 11, 2026 •

Copy link
Copy Markdown

Preview of modified files

Preview of modified Markdown:

@mnocon
mnocon marked this pull request as ready for review March 19, 2026 08:10
@mnocon
mnocon requested a review from a team March 19, 2026 08:10
@ibexa-workflow-automation-1
ibexa-workflow-automation-1 Bot requested review from adriendupuis, dabrt and julitafalcondusza and removed request for a team March 19, 2026 08:10

@adriendupuis adriendupuis left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I tested with https://doc.ibexa.co/en/5.0/administration/recent_activity/recent_activity/#context-group VS https://ez-systems-developer-documentation--3081.com.readthedocs.build/en/3081/administration/recent_activity/recent_activity/#context-group and it works really well!

Python code is hard to read but the way it get how many spaces it can remove with indent = min(len(l) - len(l.lstrip()) for l in non_empty) looks solid to me.

@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
D Maintainability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@mnocon
mnocon merged commit 2ec867c into 5.0 Mar 31, 2026
9 of 10 checks passed
@mnocon
mnocon deleted the remove-indent branch March 31, 2026 12:37
mnocon added a commit that referenced this pull request Mar 31, 2026
* Added remove_indent

* Usage example

* recent_activity.md: remove_indent

---------

Co-authored-by: Adrien Dupuis <61695653+adriendupuis@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants