Skip to content

Commit e4b83fc

Browse files
committed
Document smart punctuation
1 parent f1581ed commit e4b83fc

File tree

1 file changed

+21
-5
lines changed

1 file changed

+21
-5
lines changed

src/doc/rustdoc/src/how-to-write-documentation.md

+21-5
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ what an item is, how it is used, and for what purpose it exists.
101101
Let's see an example coming from the [standard library] by taking a look at the
102102
[`std::env::args()`][env::args] function:
103103

104-
``````text
104+
``````markdown
105105
Returns the arguments which this program was started with (normally passed
106106
via the command line).
107107

@@ -135,7 +135,7 @@ for argument in env::args() {
135135

136136
Everything before the first empty line will be reused to describe the component
137137
in searches and module overviews. For example, the function `std::env::args()`
138-
above will be shown on the [`std::env`] module documentation. It is good
138+
above will be shown on the [`std::env`] module documentation. It is good
139139
practice to keep the summary to one line: concise writing is a goal of good
140140
documentation.
141141

@@ -153,9 +153,10 @@ and finally provides a code example.
153153

154154
## Markdown
155155

156-
`rustdoc` uses the [CommonMark markdown specification]. You might be
157-
interested into taking a look at their website to see what's possible to do.
158-
- [commonmark quick reference]
156+
`rustdoc` uses the [CommonMark Markdown specification]. You might be
157+
interested in taking a look at their website to see what's possible:
158+
159+
- [CommonMark quick reference]
159160
- [current spec]
160161

161162
In addition to the standard CommonMark syntax, `rustdoc` supports several
@@ -240,6 +241,21 @@ This will render as
240241

241242
See the specification for the [task list extension] for more details.
242243

244+
### Smart punctuation
245+
246+
Some ASCII punctuation sequences will be automatically turned into fancy Unicode
247+
characters:
248+
249+
| ASCII sequence | Unicode |
250+
|----------------|---------|
251+
| `--` ||
252+
| `---` ||
253+
| `...` ||
254+
| `"` | “ or ”, depending on context |
255+
| `'` | ‘ or ’, depending on context |
256+
257+
So, no need to manually enter those Unicode characters!
258+
243259
[`backtrace`]: https://docs.rs/backtrace/0.3.50/backtrace/
244260
[commonmark markdown specification]: https://commonmark.org/
245261
[commonmark quick reference]: https://commonmark.org/help/

0 commit comments

Comments
 (0)