Skip to content

Comments

fix: remove unindent from code blocks#175

Open
bjones1 wants to merge 1 commit intodprint:mainfrom
bjones1:fix-code-block-unindent
Open

fix: remove unindent from code blocks#175
bjones1 wants to merge 1 commit intodprint:mainfrom
bjones1:fix-code-block-unindent

Conversation

@bjones1
Copy link
Contributor

@bjones1 bjones1 commented Jan 31, 2026

In Markdown,

    test

renders differently than

test

, but the current code strips the indent.

@bjones1 bjones1 marked this pull request as ready for review January 31, 2026 12:36
@dsherret dsherret changed the title Fix: remove unindent from code blocks. fix: remove unindent from code blocks Feb 3, 2026
@dsherret
Copy link
Member

dsherret commented Feb 3, 2026

I think maybe the current behaviour might be desirable and someone could use an ignore comment for codeblocks that really need this?

@bjones1
Copy link
Contributor Author

bjones1 commented Feb 4, 2026

I see dprint as a formatter, something that makes the formatting of a file consistent without changing the underlying meaning. In Markdown, that means that the HTML produced before and after running dprint won't change, but the way the Markdown is presented improves (word wrapped, consistent headings, etc.). Removing leading spaces is certainly a content change (since the resulting HTML produced differs). While I can see that some might view this as useful cleanup, I hesitate to have dpring make any true content changes to the underlying Markdown. I'm open to your thoughts, though. Perhaps we could make the remove indent in code blocks a non-default option with a warning in the docs "NOTE: changes resulting HTML, but might be your desired outcome"?

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