Re-enable hoedown by default
This commit is contained in:
parent
ff13b7c918
commit
80a2a94d5a
7 changed files with 382 additions and 150 deletions
|
@ -26,6 +26,7 @@ use html::render::reset_ids;
|
|||
use html::escape::Escape;
|
||||
use html::markdown;
|
||||
use html::markdown::{Markdown, MarkdownWithToc, find_testable_code, old_find_testable_code};
|
||||
use html::markdown::RenderType;
|
||||
use test::{TestOptions, Collector};
|
||||
|
||||
/// Separate any lines at the start of the file that begin with `# ` or `%`.
|
||||
|
@ -50,7 +51,8 @@ fn extract_leading_metadata<'a>(s: &'a str) -> (Vec<&'a str>, &'a str) {
|
|||
/// Render `input` (e.g. "foo.md") into an HTML file in `output`
|
||||
/// (e.g. output = "bar" => "bar/foo.html").
|
||||
pub fn render(input: &str, mut output: PathBuf, matches: &getopts::Matches,
|
||||
external_html: &ExternalHtml, include_toc: bool) -> isize {
|
||||
external_html: &ExternalHtml, include_toc: bool,
|
||||
render_type: RenderType) -> isize {
|
||||
let input_p = Path::new(input);
|
||||
output.push(input_p.file_stem().unwrap());
|
||||
output.set_extension("html");
|
||||
|
@ -94,9 +96,9 @@ pub fn render(input: &str, mut output: PathBuf, matches: &getopts::Matches,
|
|||
reset_ids(false);
|
||||
|
||||
let rendered = if include_toc {
|
||||
format!("{}", MarkdownWithToc(text))
|
||||
format!("{}", MarkdownWithToc(text, render_type))
|
||||
} else {
|
||||
format!("{}", Markdown(text))
|
||||
format!("{}", Markdown(text, render_type))
|
||||
};
|
||||
|
||||
let err = write!(
|
||||
|
@ -147,7 +149,8 @@ pub fn render(input: &str, mut output: PathBuf, matches: &getopts::Matches,
|
|||
|
||||
/// Run any tests/code examples in the markdown file `input`.
|
||||
pub fn test(input: &str, cfgs: Vec<String>, libs: SearchPaths, externs: Externs,
|
||||
mut test_args: Vec<String>, maybe_sysroot: Option<PathBuf>) -> isize {
|
||||
mut test_args: Vec<String>, maybe_sysroot: Option<PathBuf>,
|
||||
render_type: RenderType) -> isize {
|
||||
let input_str = match load_string(input) {
|
||||
Ok(s) => s,
|
||||
Err(LoadStringError::ReadFail) => return 1,
|
||||
|
@ -158,7 +161,8 @@ pub fn test(input: &str, cfgs: Vec<String>, libs: SearchPaths, externs: Externs,
|
|||
opts.no_crate_inject = true;
|
||||
let mut collector = Collector::new(input.to_string(), cfgs, libs, externs,
|
||||
true, opts, maybe_sysroot, None,
|
||||
Some(input.to_owned()));
|
||||
Some(input.to_owned()),
|
||||
render_type);
|
||||
old_find_testable_code(&input_str, &mut collector, DUMMY_SP);
|
||||
find_testable_code(&input_str, &mut collector, DUMMY_SP);
|
||||
test_args.insert(0, "rustdoctest".to_string());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue