Skip to content

fix: Don't aggressively trim code whitespace#24

Merged
pomber merged 2 commits intocode-hike:mainfrom
altano:main
Jul 23, 2023
Merged

fix: Don't aggressively trim code whitespace#24
pomber merged 2 commits intocode-hike:mainfrom
altano:main

Conversation

@altano
Copy link
Copy Markdown
Contributor

@altano altano commented Jul 19, 2023

If code was contained in a nested child (such as when processing markdown) we would previously aggressively .trim() the output. Since there can be intentional leading/trailing space in a markdown code block (e.g. for indentation) this is probably too aggressive.

Instead, we now just strip all trailing newlines.

BEFORE AFTER
SCR-20230718-svhk SCR-20230718-svjj

Fixes #23

@vercel
Copy link
Copy Markdown

vercel Bot commented Jul 19, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
bright ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 23, 2023 0:18am

If code was contained in a nested child (such as when processing markdown) we would previously aggressively `.trim()` the output. Since there can be intentional leading/trailing space in a markdown code block (e.g. for indentation) this is probably too aggressive.

Instead, we now just strip all trailing newlines.
@pomber
Copy link
Copy Markdown
Contributor

pomber commented Jul 23, 2023

Thank you!

@pomber pomber merged commit 2c68871 into code-hike:main Jul 23, 2023
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.

Trimming whitespace

2 participants