Skip to content

Commit

Permalink
Update to pulldown-cmark 0.5.1.
Browse files Browse the repository at this point in the history
  • Loading branch information
ehuss committed May 21, 2019
1 parent 397c3b1 commit 6c8769f
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 12 deletions.
19 changes: 15 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ serde = "1.0"
serde_derive = "1.0"
error-chain = "0.12"
serde_json = "1.0"
pulldown-cmark = "0.4.1"
pulldown-cmark = "0.5"
lazy_static = "1.0"
log = "0.4"
env_logger = "0.5"
Expand Down
2 changes: 1 addition & 1 deletion src/book/summary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ fn stringify_events(events: Vec<Event>) -> String {
events
.into_iter()
.filter_map(|t| match t {
Event::Text(text) => Some(text.into_string()),
Event::Text(text) | Event::Code(text) => Some(text.into_string()),
_ => None,
}).collect()
}
Expand Down
5 changes: 2 additions & 3 deletions src/renderer/html_handlebars/helpers/toc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::path::Path;
use utils;

use handlebars::{Context, Handlebars, Helper, HelperDef, Output, RenderContext, RenderError};
use pulldown_cmark::{html, Event, Parser, Tag};
use pulldown_cmark::{html, Event, Parser};
use serde_json;

// Handlebars helper to construct TOC
Expand Down Expand Up @@ -118,8 +118,7 @@ impl HelperDef for RenderToc {

// filter all events that are not inline code blocks
let parser = Parser::new(name).filter(|event| match *event {
Event::Start(Tag::Code)
| Event::End(Tag::Code)
Event::Code(_)
| Event::InlineHtml(_)
| Event::Text(_) => true,
_ => false,
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/html_handlebars/search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ fn render_item(
body.push(' ');
}
}
Event::Text(text) => {
Event::Text(text) | Event::Code(text) => {
if in_header {
heading.push_str(&text);
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,11 @@ impl EventQuoteConverter {
}

match event {
Event::Start(Tag::CodeBlock(_)) | Event::Start(Tag::Code) => {
Event::Start(Tag::CodeBlock(_)) => {
self.convert_text = false;
event
}
Event::End(Tag::CodeBlock(_)) | Event::End(Tag::Code) => {
Event::End(Tag::CodeBlock(_)) => {
self.convert_text = true;
event
}
Expand Down

0 comments on commit 6c8769f

Please sign in to comment.