-
Notifications
You must be signed in to change notification settings - Fork 13k
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
[rustdoc] Convert double-hyphen to dash in docs #64081
Comments
Do you have an example of where it'd be useful? In such cases, I'm afraid of side-effects of unwanted replacements or maybe users' misunderstanding. |
Well, it's just about nicer typography. See the rustc guide for example. What side effects do you imagine? The main one I can envisage is |
So still doesn't sell much of a dream: ;) |
Oh I know, the benefit is incremental... but the implementation cost is so low, and I don't see the downside. ;-) |
I mean... don't we all like nice, propr typography? |
Install a better font maybe? 😛 |
This is nothing to do with fonts... it's to do with |
I'm assuming you mean converting a pair of hyphen-minus characters into an en dash like in TeX? rustdoc uses CommonMark and unless this was added to that spec I don't think it's worth adding this feature. It's already possible to insert en dashes using |
@ollie27 Yes, I wrote it correctly in my title and the wrong way round in the comment oops. I think this is really orthogonal to Markdown to be honest... Sure, it's already possible, but no one is going to write |
I think this is simply incorrect: it's the em dash [—] that I'm trying to emulate when I use a double hyphen [--], not a single hyphen [-] (or an en dash [–] for that matter). Obviously "the actual hyphen character" is easy to type, since a double hyphen is literally just typing it twice. But assuming that was just terminology confusion, auto-converting a double hyphen to an em dash makes a lot of sense to me, and I feel like I've encountered this behavior in other tools before without complaint. Though it also seems reasonable to move this question to the CommonMark spec, since it probably ought to be done in all markdown-processing tools. |
|
Ah, seems there's already an "optional extension" to the spec, but it has |
This is my opinion as well. |
@steveklabnik See my above comment. It's an optional extension already part of the spec, according to that thread. :-) |
Unless I'm mistaken rustdoc now uses pulldown-cmark which performs this transformation. Transformation is performed inconsistently - only in blocks it considers to be markdown. This makes generating documentation in markdown with extra html styling complicated enough to the point it's easier to generate just html. Either way this ticket seems to be completed. |
It would be nice to get rustdoc to convert double-hyphen (
--
) (probably just when surrounded by spaces?) to a dash character (–
) in doc-comments. People tend to use double-hyphen in code instead of the actual actual character, since it's easier to type on most keyboards. I reckon this could be done perfectly reliably.The text was updated successfully, but these errors were encountered: