Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit abf5592

Browse files
committedMar 29, 2017
Auto merge of #40338 - GuillaumeGomez:pulldown-switch, r=frewsxcv,steveklabnik
Replace hoedown with pull in rustdoc cc @rust-lang/docs
2 parents 4465f22 + a7c6d3e commit abf5592

File tree

12 files changed

+555
-522
lines changed

12 files changed

+555
-522
lines changed
 

‎.gitmodules

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@
55
[submodule "src/compiler-rt"]
66
path = src/compiler-rt
77
url = https://github.com/rust-lang/compiler-rt.git
8-
[submodule "src/rt/hoedown"]
9-
path = src/rt/hoedown
10-
url = https://github.com/rust-lang/hoedown.git
11-
branch = rust-2015-09-21-do-not-delete
128
[submodule "src/jemalloc"]
139
path = src/jemalloc
1410
url = https://github.com/rust-lang/jemalloc.git

‎src/Cargo.lock

Lines changed: 36 additions & 26 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src/libcore/result.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -838,10 +838,10 @@ impl<T: Default, E> Result<T, E> {
838838
///
839839
/// assert_eq!(1909, good_year);
840840
/// assert_eq!(0, bad_year);
841+
/// ```
841842
///
842843
/// [`parse`]: ../../std/primitive.str.html#method.parse
843844
/// [`FromStr`]: ../../std/str/trait.FromStr.html
844-
/// ```
845845
#[inline]
846846
#[stable(feature = "result_unwrap_or_default", since = "1.16.0")]
847847
pub fn unwrap_or_default(self) -> T {

‎src/librustdoc/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
authors = ["The Rust Project Developers"]
33
name = "rustdoc"
44
version = "0.0.0"
5-
build = "build.rs"
65

76
[lib]
87
name = "rustdoc"
@@ -26,6 +25,7 @@ rustc_trans = { path = "../librustc_trans" }
2625
serialize = { path = "../libserialize" }
2726
syntax = { path = "../libsyntax" }
2827
syntax_pos = { path = "../libsyntax_pos" }
28+
pulldown-cmark = { version = "0.0.14", default-features = false }
2929

3030
[build-dependencies]
3131
build_helper = { path = "../build_helper" }

‎src/librustdoc/build.rs

Lines changed: 0 additions & 29 deletions
This file was deleted.

‎src/librustdoc/html/markdown.rs

Lines changed: 502 additions & 449 deletions
Large diffs are not rendered by default.

‎src/librustdoc/html/render.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ use html::format::{TyParamBounds, WhereClause, href, AbiSpace};
7272
use html::format::{VisSpace, Method, UnsafetySpace, MutableSpace};
7373
use html::format::fmt_impl_for_trait_page;
7474
use html::item_type::ItemType;
75-
use html::markdown::{self, Markdown, MarkdownHtml};
75+
use html::markdown::{self, Markdown, MarkdownHtml, MarkdownOutputStyle};
7676
use html::{highlight, layout};
7777

7878
/// A pair of name and its optional document.
@@ -1650,7 +1650,8 @@ fn document_short(w: &mut fmt::Formatter, item: &clean::Item, link: AssocItemLin
16501650
} else {
16511651
format!("{}", &plain_summary_line(Some(s)))
16521652
};
1653-
write!(w, "<div class='docblock'>{}</div>", Markdown(&markdown))?;
1653+
write!(w, "<div class='docblock'>{}</div>",
1654+
Markdown(&markdown, MarkdownOutputStyle::Fancy))?;
16541655
}
16551656
Ok(())
16561657
}
@@ -1683,7 +1684,8 @@ fn get_doc_value(item: &clean::Item) -> Option<&str> {
16831684
fn document_full(w: &mut fmt::Formatter, item: &clean::Item) -> fmt::Result {
16841685
if let Some(s) = get_doc_value(item) {
16851686
write!(w, "<div class='docblock'>{}</div>",
1686-
Markdown(&format!("{}{}", md_render_assoc_item(item), s)))?;
1687+
Markdown(&format!("{}{}", md_render_assoc_item(item), s),
1688+
MarkdownOutputStyle::Fancy))?;
16871689
}
16881690
Ok(())
16891691
}
@@ -1871,7 +1873,8 @@ fn item_module(w: &mut fmt::Formatter, cx: &Context,
18711873
</tr>",
18721874
name = *myitem.name.as_ref().unwrap(),
18731875
stab_docs = stab_docs,
1874-
docs = shorter(Some(&Markdown(doc_value).to_string())),
1876+
docs = shorter(Some(&Markdown(doc_value,
1877+
MarkdownOutputStyle::Compact).to_string())),
18751878
class = myitem.type_(),
18761879
stab = myitem.stability_class().unwrap_or("".to_string()),
18771880
unsafety_flag = unsafety_flag,
@@ -2901,7 +2904,7 @@ fn render_impl(w: &mut fmt::Formatter, cx: &Context, i: &Impl, link: AssocItemLi
29012904
write!(w, "</span>")?;
29022905
write!(w, "</h3>\n")?;
29032906
if let Some(ref dox) = i.impl_item.doc_value() {
2904-
write!(w, "<div class='docblock'>{}</div>", Markdown(dox))?;
2907+
write!(w, "<div class='docblock'>{}</div>", Markdown(dox, MarkdownOutputStyle::Fancy))?;
29052908
}
29062909
}
29072910

‎src/librustdoc/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// except according to those terms.
1010

1111
#![crate_name = "rustdoc"]
12-
#![unstable(feature = "rustdoc", issue = "27812")]
12+
#![unstable(feature = "rustc_private", issue = "27812")]
1313
#![crate_type = "dylib"]
1414
#![crate_type = "rlib"]
1515
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
@@ -48,6 +48,7 @@ extern crate test as testing;
4848
extern crate std_unicode;
4949
#[macro_use] extern crate log;
5050
extern crate rustc_errors as errors;
51+
extern crate pulldown_cmark;
5152

5253
extern crate serialize as rustc_serialize; // used by deriving
5354

‎src/librustdoc/markdown.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use externalfiles::{ExternalHtml, LoadStringError, load_string};
2525
use html::render::reset_ids;
2626
use html::escape::Escape;
2727
use html::markdown;
28-
use html::markdown::{Markdown, MarkdownWithToc, find_testable_code};
28+
use html::markdown::{Markdown, MarkdownWithToc, MarkdownOutputStyle, find_testable_code};
2929
use test::{TestOptions, Collector};
3030

3131
/// Separate any lines at the start of the file that begin with `# ` or `%`.
@@ -96,7 +96,7 @@ pub fn render(input: &str, mut output: PathBuf, matches: &getopts::Matches,
9696
let rendered = if include_toc {
9797
format!("{}", MarkdownWithToc(text))
9898
} else {
99-
format!("{}", Markdown(text))
99+
format!("{}", Markdown(text, MarkdownOutputStyle::Fancy))
100100
};
101101

102102
let err = write!(

‎src/rt/hoedown

Lines changed: 0 additions & 1 deletion
This file was deleted.

‎src/rustc/rustdoc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![feature(rustdoc)]
11+
#![feature(rustc_private)]
1212

1313
extern crate rustdoc;
1414

‎src/tools/error_index_generator/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use std::path::PathBuf;
2424

2525
use syntax::diagnostics::metadata::{get_metadata_dir, ErrorMetadataMap, ErrorMetadata};
2626

27-
use rustdoc::html::markdown::{Markdown, PLAYGROUND};
27+
use rustdoc::html::markdown::{Markdown, MarkdownOutputStyle, PLAYGROUND};
2828
use rustc_serialize::json;
2929

3030
enum OutputFormat {
@@ -100,7 +100,7 @@ impl Formatter for HTMLFormatter {
100100

101101
// Description rendered as markdown.
102102
match info.description {
103-
Some(ref desc) => write!(output, "{}", Markdown(desc))?,
103+
Some(ref desc) => write!(output, "{}", Markdown(desc, MarkdownOutputStyle::Fancy))?,
104104
None => write!(output, "<p>No description.</p>\n")?,
105105
}
106106

0 commit comments

Comments
 (0)
Please sign in to comment.