mundschenk-at / wp-typography

Improve your WordPress micro typography.
https://code.mundschenk.at/wp-typography/
Other
22 stars 3 forks source link

[Feature] Prevent break between bracket and space / space and bracket #291

Closed strarsis closed 1 year ago

strarsis commented 3 years ago

Having a space between a bracket and its enclosing text, e.g. ( descriptive text ), can cause the bracket to break without the text it is enclosing:

(
descriptive text )
( descriptive text
)

and

(
descriptive text
)

This happens with text in French language for example where real spaces between bracket and enclosed text is intentional.

In other languages, some CMS users add a space between bracket and enclosed text just for decorative purposes. This should be handled by CSS instead, which is hard because CSS currently (and quite probably also in the near to mid future) can't select individual letters without using a JavaScript or server-side wrapping tool.

mundschenk-at commented 3 years ago

What would be the expected result after processing? Wrapping the brackets in a <span> would be counter-productive if the goal is to prevent a break. I could replace the space with &nbsp;, but I don't know if this breaks other things (e.g. LaTeX parsers).

We should continue this discussion in https://github.com/mundschenk-at/php-typography.