Bump pulldown_cmark to version 0.6.0 (#375)

This commit is contained in:
Marcus Klaas de Vries 2019-09-06 17:21:20 +00:00 committed by Alexandre Bury
parent b3fed80939
commit 3ff9c3ce0d
2 changed files with 6 additions and 7 deletions

View File

@ -63,7 +63,7 @@ version = "0.16.1"
[dependencies.pulldown-cmark] [dependencies.pulldown-cmark]
default-features = false default-features = false
optional = true optional = true
version = "0.5.3" version = "0.6.0"
[dependencies.termion] [dependencies.termion]
optional = true optional = true

View File

@ -51,7 +51,7 @@ impl<'a> Parser<'a> {
} }
} }
fn header(level: usize) -> &'static str { fn heading(level: usize) -> &'static str {
&"##########"[..level] &"##########"[..level]
} }
@ -71,15 +71,14 @@ impl<'a> Iterator for Parser<'a> {
Tag::Emphasis => { Tag::Emphasis => {
self.stack.push(Style::from(Effect::Italic)) self.stack.push(Style::from(Effect::Italic))
} }
Tag::Header(level) => { Tag::Heading(level) => {
return Some( return Some(
self.literal(format!( self.literal(format!(
"{} ", "{} ",
header(level as usize) heading(level as usize)
)), )),
) )
} }
Tag::Rule => return Some(self.literal("---")),
Tag::BlockQuote => return Some(self.literal("> ")), Tag::BlockQuote => return Some(self.literal("> ")),
Tag::Link(_, _, _) => return Some(self.literal("[")), Tag::Link(_, _, _) => return Some(self.literal("[")),
Tag::CodeBlock(_) => return Some(self.literal("```")), Tag::CodeBlock(_) => return Some(self.literal("```")),
@ -92,7 +91,7 @@ impl<'a> Iterator for Parser<'a> {
Event::End(tag) => match tag { Event::End(tag) => match tag {
// Remove from stack! // Remove from stack!
Tag::Paragraph if self.first => self.first = false, Tag::Paragraph if self.first => self.first = false,
Tag::Header(_) => return Some(self.literal("\n\n")), Tag::Heading(_) => return Some(self.literal("\n\n")),
Tag::Link(_, link, _) => { Tag::Link(_, link, _) => {
return Some(self.literal(format!("]({})", link))) return Some(self.literal(format!("]({})", link)))
} }
@ -102,11 +101,11 @@ impl<'a> Iterator for Parser<'a> {
} }
_ => (), _ => (),
}, },
Event::Rule => return Some(self.literal("---")),
Event::SoftBreak => return Some(self.literal("\n")), Event::SoftBreak => return Some(self.literal("\n")),
Event::HardBreak => return Some(self.literal("\n")), Event::HardBreak => return Some(self.literal("\n")),
// Treat all text the same // Treat all text the same
Event::FootnoteReference(text) Event::FootnoteReference(text)
| Event::InlineHtml(text)
| Event::Html(text) | Event::Html(text)
| Event::Text(text) | Event::Text(text)
| Event::Code(text) => { | Event::Code(text) => {