Whitespace treatment in <tt> #753
Replies: 10 comments
-
A temporary workaround is using
|
Beta Was this translation helpful? Give feedback.
-
Thanks @kesara, but doesn't that result in the HTML containing extra characters? It appears to include the word joiners, which would mean that someone who copies and pastes the text would get the (potentially invisible) extra character. |
Beta Was this translation helpful? Give feedback.
-
Yeah, they end up as invisible characters in HTML output. |
Beta Was this translation helpful? Give feedback.
-
Wouldn't it be straightforward to use CSS to ensure that the correct text is copied? (e.g. by wrapping the word joiner in a span that is made unselectable by CSS) |
Beta Was this translation helpful? Give feedback.
-
If it's important that the string be unbroken on one line, I'd make it |
Beta Was this translation helpful? Give feedback.
-
@JayDaley, that's even more complicated than what I was suggesting. @jrlevine, that's possible, but it would be difficult in this case to ensure that all uses of the string appear on a separate line like that. We use the same string about 5 times. Ideally, all instances are available for copying without error. And a newline is problematic in the middle of a list (as in the image). |
Beta Was this translation helpful? Give feedback.
-
Handing through the equivalent of css nowrap has come up more than a few times for <tt. Much of the &nbhy and &wj usage would go away. |
Beta Was this translation helpful? Give feedback.
-
I've spent a bit of time building a web page with wj/nbhy/nbsp to see what gets copied to the keyboard and to see if that can be controlled with CSS. It looks as if that is a hard problem to solve, if it is solvable. We should instead consider a new element such <term> that is rendered in HTML as no-wrap but has no specific visible styling applied. We should allow this to be used inside <tt>. This would be better than changing the styling of <tt> because a) we would have to check how that has been used elsewhere and b) people might not want the constant width formatting just to achieve a no-wrap. |
Beta Was this translation helpful? Give feedback.
-
That would work for me. |
Beta Was this translation helpful? Give feedback.
-
On 10. Mar 2022, at 20:56, Jay Daley ***@***.***> wrote:
We should instead consider a new element such <term> that is rendered in as no-wrap but has no specific visible styling applied. We should allow this to be used inside <tt>. This would be better than changing the styling of <tt> because a) we would have to check how that has been used elsewhere and b) people might not want the constant width formatting just to achieve a no-wrap.
Exactly this.
We might even call it <nobr>. (Ducks)
Grüße, Carsten
… and then we have to figure out how to represent this in markdown.
Maybe together with sup, sub, …
It also would be great to have a featureless span one can hang IALs on…
|
Beta Was this translation helpful? Give feedback.
-
I have a draft in which there is an important string that is breaking at a space (I have another case that breaks at the '/' character as well):
This particular example isn't that big of a problem, as there are other cases where the space appears correctly. However, as the space is critical to the functioning of the protocol, this is something I'd like to fix. Ideally without having to rewrite this text so carefully that the text and HTML renderings don't both show the issue.
There are probably elements other than
<tt>
that would benefit from the same sort of treatment, but it would be sufficient for this to be the only one affected thus.CSS has the property
white-space: nowrap;
which might be used to prevent this sort of thing. Is there some way we can control the rendering of certain elements that might end up being rendered incorrectly this way?(I realize that this is probably input to the discussion on RFC 7991 bis, but I've given up on trying to find where that discussion is happening. This issue at least memorializes this requirement.)
Beta Was this translation helpful? Give feedback.
All reactions