fix(docs-infra): fix code block deindentation in docs-code and docs-code-block#68566
Open
swseverance wants to merge 2 commits intoangular:mainfrom
Open
fix(docs-infra): fix code block deindentation in docs-code and docs-code-block#68566swseverance wants to merge 2 commits intoangular:mainfrom
swseverance wants to merge 2 commits intoangular:mainfrom
Conversation
…ode-block Consolidates deindentation logic into formatCode so both docs-code and docs-code-block are covered by a single fix. The original deindent function incorrectly iterated over blank lines instead of non-blank lines when computing minimum indentation, causing code blocks to render with excessive leading whitespace. Also fixes region extraction which had the same trim-before-deindent ordering issue.
JeanMeche
reviewed
May 5, 2026
Comment on lines
+63
to
+64
| expect(codeBlock?.textContent).not.toContain(' // bar'); | ||
| expect(codeBlock?.textContent).toContain(' // bar'); |
Member
There was a problem hiding this comment.
Suggested change
| expect(codeBlock?.textContent).not.toContain(' // bar'); | |
| expect(codeBlock?.textContent).toContain(' // bar'); | |
| expect(codeBlock?.textContent).toMatch(/^ \/\/ bar/); |
Contributor
Author
There was a problem hiding this comment.
@JeanMeche updated to your suggestion with a small modification (the addition of the "m" flag to the regex)
|
Deployed adev-preview for b157589 to: https://ng-dev-previews-fw--pr-angular-angular-68566-adev-prev-5yfepf5l.web.app Note: As new commits are pushed to this pull request, this link is updated after the preview is rebuilt. |
Replace two toContain assertions with a single toMatch using a multiline regex, per reviewer suggestion.
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.
Consolidates deindentation logic into formatCode so both docs-code and docs-code-block are covered by a single fix. The original deindent function incorrectly iterated over blank lines instead of non-blank lines when computing minimum indentation, causing code blocks to render with excessive leading whitespace. Also fixes region extraction which had the same trim-before-deindent ordering issue.
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
The indentation of many of the code samples is showing up incorrectly. For example:
Issue Number: N/A
What is the new behavior?
Leading indentation is properly stripped from code samples
Does this PR introduce a breaking change?
Other information