diff options
| author | bors <bors@rust-lang.org> | 2023-07-05 06:18:46 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-07-05 06:18:46 +0000 |
| commit | 6dab6dc5fcd9655adfa7bfb3e59e5cae487184d2 (patch) | |
| tree | e0db27e4c7f547bc92e3d239d3872a5ecc0f90b8 /compiler/rustc_errors/src/markdown/tests/input.md | |
| parent | 9227ff28aff55b252314076fcf21c9a66f10ac1e (diff) | |
| parent | 6a1c10bd85442f52f1d55d51005481cfa5cb40b5 (diff) | |
| download | rust-6dab6dc5fcd9655adfa7bfb3e59e5cae487184d2.tar.gz rust-6dab6dc5fcd9655adfa7bfb3e59e5cae487184d2.zip | |
Auto merge of #112697 - tgross35:explain-markdown, r=oli-obk
Add simple markdown formatting to `rustc --explain` output This is a second attempt at #104540, which is #63128 without dependencies. This PR adds basic markdown formatting to `rustc --explain` output when available. Currently, the output just displays raw markdown: this works of course, but it really doesn't look very elegant. (output is `rustc --explain E0038`) <img width="583" alt="image" src="https://github.com/rust-lang/rust/assets/13724985/ea418117-47af-455b-83c0-6fc59276efee"> After this patch, sample output from the same file: <img width="693" alt="image" src="https://github.com/rust-lang/rust/assets/13724985/12f7bf9b-a3fe-4104-b74b-c3e5227f3de9"> This also obeys the `--color always/auto/never` command option. Behavior: - If pager is available and supports color, print with formatting to the pager - If pager is not available or fails print with formatting to stdout - otherwise without formatting - Follow `--color always/never` if suppied - If everything fails, just print plain text to stdout r? `@oli-obk` cc `@estebank` (since the two of you were involved in the previous discussion)
Diffstat (limited to 'compiler/rustc_errors/src/markdown/tests/input.md')
| -rw-r--r-- | compiler/rustc_errors/src/markdown/tests/input.md | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/compiler/rustc_errors/src/markdown/tests/input.md b/compiler/rustc_errors/src/markdown/tests/input.md new file mode 100644 index 00000000000..7d207fc4220 --- /dev/null +++ b/compiler/rustc_errors/src/markdown/tests/input.md @@ -0,0 +1,50 @@ +# H1 Heading [with a link][remote-link] + +H1 content: **some words in bold** and `so does inline code` + +## H2 Heading + +H2 content: _some words in italic_ + +### H3 Heading + +H3 content: ~~strikethrough~~ text + +#### H4 Heading + +H4 content: A [simple link](https://docs.rs) and a [remote-link]. + +--- + +A section break was above. We can also do paragraph breaks: + +(new paragraph) and unordered lists: + +- Item 1 in `code` +- Item 2 in _italics_ + +Or ordered: + +1. Item 1 in **bold** +2. Item 2 with some long lines that should wrap: Lorem ipsum dolor sit amet, + consectetur adipiscing elit. Aenean ac mattis nunc. Phasellus elit quam, + pulvinar ac risus in, dictum vehicula turpis. Vestibulum neque est, accumsan + in cursus sit amet, dictum a nunc. Suspendisse aliquet, lorem eu eleifend + accumsan, magna neque sodales nisi, a aliquet lectus leo eu sem. + +--- + +## Code + +Both `inline code` and code blocks are supported: + +```rust +/// A rust enum +#[derive(Debug, PartialEq, Clone)] +enum Foo { + /// Start of line + Bar +} +``` + +[remote-link]: http://docs.rs |
