Skip to content

Instantly share code, notes, and snippets.

@KevinBatdorf
Last active March 27, 2023 13:18
Show Gist options
  • Save KevinBatdorf/1c365af7b799c142ed3cd91a51329f4c to your computer and use it in GitHub Desktop.
Save KevinBatdorf/1c365af7b799c142ed3cd91a51329f4c to your computer and use it in GitHub Desktop.
Word Wrap Example for Code Block Pro WordPress plugin (if line numbers enabled)
div.wp-block-kevinbatdorf-code-block-pro:not(.code-block-pro-editor) pre code {
overflow-wrap: break-word !important;
/* In some cases you may need the max() */
padding: 0 2rem 0 max(var(--cbp-line-number-width), 2rem) !important;
white-space: pre-wrap !important;
word-break: break-word !important;
}
div.wp-block-kevinbatdorf-code-block-pro:not(.code-block-pro-editor) pre code .line {
min-height: 1.625rem;
position: static !important;
}
div.wp-block-kevinbatdorf-code-block-pro.cbp-has-line-numbers:not(.code-block-pro-editor) pre code .line:not(.cbp-line-number-disabled):before {
position: absolute;
left: 0.5rem;
/* In some cases you may need the max() */
width: max(var(--cbp-line-number-width), 2rem) !important;
}
@tpickel
Copy link

tpickel commented Mar 24, 2023

Thank you very much Kevin!

-- Tom

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment