-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Ensure em dashes are recognizable in markup #11646
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @weihanglo (or someone else) soon. Please see the contribution instructions for more information. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for raising up this issue. I don't entirely agree with the solution, however. It would be better if we can keep the original source as readable as rendered one. Let's see what others say.
Just also saw it used here: https://github.com/dtolnay/indoc/blob/master/README.md?plain=1#L75. |
As a non-English native speaker, choosing from different kinds of dashes is sometimes a headache to me. Yet, some developers prefer to read docs in their terminal emulators. I don't quite feel this patch more readable than the old one. The example you provided has the same problem: Perhaps instead of this patch, we need a rule and an automation to help us fix this issue. BTW, it seems like several crates from dtolnay pick HTML entities over literals. Curious to know the reason behind the back. |
I'm not sure what is expected from me now. Your comment sounds like more opinions from your collegues are needed. I can understand that I don't know about @dtolnay's reasoning. When it comes to doc comments on code items, I'm torn between nice rendering and readability of raw markup, but ultimately favor the latter. Ideally, |
We can consider enabling smart punctuation (it's an option in book.toml), though it is a triple |
I noticed generated docs contain the typographically correct apostrophe //! `function_1()` - Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.
//! `function_2()` - At vero eos et accusam et justo duo dolores et ea rebum.
//! `function_3()` - Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. |
They are two different systems AFAIK. The tool “The Cargo Book” uses is called mdbook, whereas rustdoc is a tool in https://github.com/rust-lang/rust/tree/master/src/librustdoc. Eric has mentioned smart punctuations feature in mdbook, which is off by default. We could enable it here and then update each page accordingly. Do you want to give this approach a shot? |
I could do that. I just checked with |
I guess rust-analyzer provides just raw contents to the LSP client, which is effectively VS Code. The display depends on how a client renders them. rust-analyzer indeed can provide unicode version of them, yet I don't feel like rendering should be a thing done by a language server. |
And just the smart-punctuation prestage? Is it possible on it's own, while otherwise still serving markdown to the IDE? Since it's an addition to markdown, we may not ever see it rendered better. |
Let's focus on the PR itself. If you want a further discussion, feel free to chat on the dedicated rust-analyzer zulip stream. |
Sorry for the noise. Seems like renaming a branch closes the PR. |
—
I carefully changed .md files in src/doc. Among the the source texts that I changed to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your quick reply!
One thing I forgot to mention. We also need to enable output.html.curly-quotes
in src/doc/contrib/book.toml
.
May I add a translation of |
I don't have enough knowledge for reviewing Windows batch script. I might redirect it to another reviewer for such a change. |
Also correct some hyphens to em dashes.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah we eventually got here! Thank you for your contribution and patience so far!
This PR changes the help manual rendering, including
- Enabled smart punctuation in mdbook for The Cargo book and Cargo Contributor Guide.
- Upgraded pulldown-cmark to v0.9.2. This upgrade breaks some tests, but they are indeed the correct behavior (see Ensure em dashes are recognizable in markup #11646 (comment)).
- Implemented the same smart punctuation functionality in
mdman
for roff and text output. This changes the rendered result ofOptionsHelper
in mdman. It rendersto an{{#option "_named-arg..._"}} A named argument. {{/option}}
<dt>
containing an id with unicode ellipsisoption-options-named-arg…
, which previously was just three dotsoption-options-named-arg...
. I scanned the codebase and it seems that in Cargo we don't have such an option, so it is unlikely to break old links. (See Ensure em dashes are recognizable in markup #11646 (comment))
After this PR, when writing contents for The Cargo book or Cargo Contributor Guide, use ---
for em dash. That's the whole point. If anyone feels wrong to merge this, let us know here or on Zulip. We can always consider a revert.
@bors r+ |
☀️ Test successful - checks-actions |
Amend `mdman` tests. - Revert most of changes to expected test output from commit 2a4ec9f. - Keep later changes to expected test output from commit 0263ef4. - Change test input that's converted to trigger similar output as previously. Following [this](#11646 (comment)) comment from `@ehuss.`
Previously mdbook was bumped in rust-lang#11646 for contrib.yml worflow but forgot main.yaml workflow. This makes the two in sync and also upgrade to the latest 0.4.27. (Though there is nothing really changed for application users as us)
Previously mdbook was bumped in rust-lang#11646 for contrib.yml worflow but main.yaml workflow. This makes the two in sync and also upgrades to the latest 0.4.27. (Though there is nothing really changed for application users as us)
chore: bump mdbook to 0.4.27 Previously mdbook was bumped in #11646 for contrib.yml worflow but main.yaml workflow. This makes the two in sync and also upgrades to the latest 0.4.27. (Though there is nothing really changed for application users as us)
10 commits in 39c13e67a5962466cc7253d41bc1099bbcb224c3..17b3d0de0897e1c6b8ca347bd39f850bb0a5b9f6 2023-02-12 02:01:08 +0000 to 2023-02-17 19:45:09 +0000 - fix: unsupported protocol error on old macos version (rust-lang/cargo#11733) - Error on invalid alphanumeric token for crates.io (rust-lang/cargo#11600) - Add clippy lints (rust-lang/cargo#11722) - chore: Make dependencies alphabetical order (rust-lang/cargo#11719) - chore: bump mdbook to 0.4.27 (rust-lang/cargo#11716) - Amend `mdman` tests. (rust-lang/cargo#11715) - Run CI for macOS on nightly (rust-lang/cargo#11712) - doc: doc comments and intra-doc links for `core::compiler` (rust-lang/cargo#11711) - Ensure em dashes are recognizable in markup (rust-lang/cargo#11646) - Set CARGO_BIN_NAME environment variable also for binary examples (rust-lang/cargo#11705)
Update cargo 10 commits in 39c13e67a5962466cc7253d41bc1099bbcb224c3..17b3d0de0897e1c6b8ca347bd39f850bb0a5b9f6 2023-02-12 02:01:08 +0000 to 2023-02-17 19:45:09 +0000 - fix: unsupported protocol error on old macos version (rust-lang/cargo#11733) - Error on invalid alphanumeric token for crates.io (rust-lang/cargo#11600) - Add clippy lints (rust-lang/cargo#11722) - chore: Make dependencies alphabetical order (rust-lang/cargo#11719) - chore: bump mdbook to 0.4.27 (rust-lang/cargo#11716) - Amend `mdman` tests. (rust-lang/cargo#11715) - Run CI for macOS on nightly (rust-lang/cargo#11712) - doc: doc comments and intra-doc links for `core::compiler` (rust-lang/cargo#11711) - Ensure em dashes are recognizable in markup (rust-lang/cargo#11646) - Set CARGO_BIN_NAME environment variable also for binary examples (rust-lang/cargo#11705) r? `@ghost`
An em dash (—) isn't well-recognizable in a monospace font. There were already a couple of locations where a hyphen was used instead. These were also corrected to
—
.—
should reduce the probability of a hyphen being used for new entries.