1
Fork 0

Upgrade dependencies

This commit is contained in:
Jan-Erik Rediger 2020-04-06 10:20:29 +02:00
parent be07a35d73
commit 51f3adb606
3 changed files with 616 additions and 511 deletions

1113
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -9,9 +9,9 @@ repository = "https://github.com/badboy/mdbook-toc"
[dependencies]
mdbook = "0.3"
pulldown-cmark = "0.5"
pulldown-cmark-to-cmark = "1.2"
env_logger = "0.6"
pulldown-cmark = "0.6.1"
pulldown-cmark-to-cmark = "2.0.1"
env_logger = "0.7.1"
log = "0.4"
clap = "2.33"
serde_json = "1.0"

View file

@ -35,7 +35,7 @@ impl Preprocessor for Toc {
}
}
fn build_toc<'a>(toc: &[(i32, CowStr<'a>)]) -> String {
fn build_toc<'a>(toc: &[(u32, CowStr<'a>)]) -> String {
let mut result = String::new();
for (level, name) in toc {
@ -53,7 +53,7 @@ fn add_toc(content: &str) -> Result<String> {
let mut toc_found = false;
let mut toc_content = vec![];
let mut current_header_level: Option<i32> = None;
let mut current_header_level: Option<u32> = None;
for e in Parser::new(&content) {
if let Event::Html(html) = e {
@ -66,13 +66,13 @@ fn add_toc(content: &str) -> Result<String> {
continue;
}
if let Event::Start(Header(lvl)) = e {
if let Event::Start(Heading(lvl)) = e {
if lvl < 5 {
current_header_level = Some(lvl);
}
continue;
}
if let Event::End(Header(_)) = e {
if let Event::End(Heading(_)) = e {
current_header_level = None;
continue;
}