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

Inline code blocks: no white space breaks #48

Closed
wants to merge 1 commit into from
Closed

Inline code blocks: no white space breaks #48

wants to merge 1 commit into from

Conversation

kartva
Copy link
Contributor

@kartva kartva commented Jan 5, 2022

Inline code (`like so`) has white-space: normal set, which makes it break:
like
so

instead of carrying over to the next line.
like so

ref: #46

Previously, text within code blocks (like `this text` would break into:
 `this
 text` if it was going to overflow.
 Now text will not break, but
 text WILL preserve sequences of whitespaces (such as tabs)
 ref: https://developer.mozilla.org/en-US/docs/Web/CSS/white-space
@vercel
Copy link

vercel bot commented Jan 5, 2022

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/ejmg/zerm/7ynq4jBgPhF9fGCKq6Sfff6Euq8M
✅ Preview: https://zerm-git-fork-desmondwillowbrook-inline-code-breaks-ejmg.vercel.app

@ejmg
Copy link
Owner

ejmg commented Jan 24, 2022

Hey, thanks for the patch and sorry for taking such a long time to respond.

My only question is when is this behavior actually occurring? As of now, the demo site doesn't demonstrate it except for when used inside of a narrow table column (look at the bottom row for "Inspectah Deck" here). Compare this to your patch (here) and it looks like a regression.

I don't have the time to find the behavior myself, but if you can show me when and how this line breaking triggers then we can work towards stopping it without breaking other stylings.

@kartva
Copy link
Contributor Author

kartva commented Jan 29, 2022

Hmm, you're right. I was aiming for something like - prioritize breaking surrounding text first and then code blocks if line still doesn't fit, but I'm afraid I don't have enough experience with CSS to know if that's even possible.

@ejmg
Copy link
Owner

ejmg commented Feb 1, 2022

prioritize breaking surrounding text first and then code blocks if line still doesn't fit

do you have an example of where this is done elsewhere? this sounds almost like font-setting proper, ie like LaTeX.

I'm afraid I don't have enough experience with CSS to know if that's even possible.

don't feel bad, a lot of us only touch CSS when we have to.

That said, it looks like CSS has an attribute for pre like text that still respects line breaking when necessary via pre-wrap. AFAICT, it'll keep any whitespace formatting within the snippet of code as provided and only wrap when required by space limitation, eg like the "Inspectah Deck" table entry I listed above.

Would this work towards your needs? We would have to do some minor research to make sure it doesn't cause weird behaviors elsewhere but it does seem like a reasonable way to provide line breaking for code formatted sections that aren't code blocks proper.

@kartva
Copy link
Contributor Author

kartva commented Feb 4, 2022

Unfortunately, pre-wrap doesn't work.

orci ultrices dolor, at vulputate neque nulla lacinia eros. `Sed id ligula quis
est convallis tempor.` Curabitur lacinia pulvinar nibh. Nam a sapien.

Instead of expected output:

orci ultrices dolor, at vulputate neque nulla lacinia eros.
`Sed id ligula quis est convallis tempor.` Curabitur lacinia pulvinar nibh. Nam a sapien.

@kartva kartva closed this Jul 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants