Skip to content

Commit

Permalink
don't render token when whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
souporserious committed May 13, 2024
1 parent 9a9d33a commit ef4b03a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/stale-goats-rush.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"mdxts": patch
---

Fixes unnecessarily rendering token when it is whitespace.
5 changes: 2 additions & 3 deletions packages/mdxts/src/components/CodeBlock/Tokens.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,8 @@ export async function Tokens({
const hasSymbolMeta = token.diagnostics || token.quickInfo

if (
!hasTextStyles &&
!hasSymbolMeta &&
(token.isBaseColor || token.isWhitespace)
token.isWhitespace ||
(!hasTextStyles && !hasSymbolMeta && token.isBaseColor)
) {
return token.value
}
Expand Down

0 comments on commit ef4b03a

Please sign in to comment.