Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions crates/mdbook-html/front-end/css/general.css
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,13 @@ code {
font-family: var(--mono-font) !important;
font-size: var(--code-font-size);
direction: ltr !important;
text-autospace: no-autospace;
}

/* make long words/inline code not x overflow */
main {
overflow-wrap: break-word;
text-autospace: normal;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks reasonable.

Does it matter that caniuse shows its usage rate is only 77%?

https://caniuse.com/mdn-css_properties_text-autospace

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For those non-CJK users, it is kinda a best practice among programmers that you insert space between CJK and other ASCII characters for readability. See https://github.com/sparanoid/chinese-copywriting-guidelines. And there is a well-known plugin for this behavior: https://github.com/vinta/pangu.js.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess the reason for the low rate is the common usage of old Chrome. I'm not sure to what extent does mdbook want to maintain compatibility.

And for pangu, I think text-autospace is just a browser built-in solution for it? I remember that pangu has some visual issues since it scans all text and insert whitespaces at runtime.

}

/* make wide tables scroll if they overflow */
Expand Down