Skip to content

Commit

Permalink
fix(theme-classic): code block wrap mode should allow wrapping in the…
Browse files Browse the repository at this point in the history
… middle of a word (#7551)
  • Loading branch information
slorber authored Jun 2, 2022
1 parent abe5450 commit 17fe43e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/docusaurus-theme-common/src/hooks/useCodeWordWrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ export function useCodeWordWrap(): {
codeElement.removeAttribute('style');
} else {
codeElement.style.whiteSpace = 'pre-wrap';
// When code wrap is enabled, we want to avoid a scrollbar in any case
// Ensure that very very long words/strings/tokens still wrap
codeElement.style.overflowWrap = 'anywhere';
}

setIsEnabled((value) => !value);
Expand Down

0 comments on commit 17fe43e

Please sign in to comment.