code-hike / bright

React Server Component for syntax highlighting
https://bright.codehike.org
1.45k stars 20 forks source link

fix: Don't aggressively trim code whitespace #24

Closed altano closed 1 year ago

altano commented 1 year ago

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 https://github.com/code-hike/bright/issues/23

vercel[bot] commented 1 year ago

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
pomber commented 1 year ago

Thank you!