Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent Code blocks from having line breaks removed #453

Open
westonruter opened this issue Oct 5, 2021 · 2 comments
Open

Prevent Code blocks from having line breaks removed #453

westonruter opened this issue Oct 5, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@westonruter
Copy link
Owner

westonruter commented Oct 5, 2021

As reported on the support forum, some themes/plugins include this CSS rule:

:not(pre)>code[class*=language-] {
    padding: .1em;
    border-radius: .3em;
    white-space: normal;
}

Apparently it's trying to style code tags that appear inside paragraphs and not in pre tags. However, we wrap the code inside of a div inside of a pre, so this causes the style to break.

The workaround I provided was:

pre[data-shcb-language-slug]>div>code {
    white-space: pre;
}

We should consider including that by default.

@westonruter westonruter added the bug Something isn't working label Oct 5, 2021
@allejo
Copy link
Collaborator

allejo commented Oct 12, 2021

Ew... I hate theme battles. I'd be okay with adding this extra rule to our stylesheet. As long as this doesn't break soft wraps. Maybe combine it here?

.wp-block-code code.hljs:not(.shcb-wrap-lines) {
white-space: pre;
}

@westonruter
Copy link
Owner Author

Yeah, that looks promising.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants