Permalink
Browse files

Update to version 0.20 of CommonMark spec

Version 0.20 of CommonMark contained a tweak to lists with indent,
and this patch tracks the change.

Also, limiting bracket nesting in lists to some reasonable number,
preventing pathologically slow behavior at high nesting levels (the
algorithm is O(n^3). Nesting of inline markup is still an issue.

Also bumping to 0.0.3 and pushing to cargo.

553/553 tests passed
  • Loading branch information...
raphlinus committed Jun 9, 2015
1 parent 5ce6d7a commit c2ef772d8264d3064cad94956d26822aa82b189b
Showing with 5 additions and 2 deletions.
  1. +1 −1 Cargo.toml
  2. +4 −1 src/parse.rs
View
@@ -1,6 +1,6 @@
[package]
name = "pulldown-cmark"
version = "0.0.2"
version = "0.0.3"
authors = [ "Raph Levien <raph@google.com>" ]
license = "Apache-2.0"
description = "A pull parser for CommonMark"
View
@@ -102,6 +102,8 @@ pub struct Options(u32);
const OPTION_FIRST_PASS: u32 = 1 << 0;
const MAX_LINK_NEST: usize = 10;
impl Options {
pub fn new() -> Options {
Options(0)
@@ -375,7 +377,7 @@ impl<'a> RawParser<'a> {
}
}
if self.leading_space >= 4 {
if self.leading_space >= 4 && !self.at_list(1).is_some() {
// see below
if let Some(&Container::List(_, _)) = self.containers.last() {
return Some(self.end());
@@ -1008,6 +1010,7 @@ impl<'a> RawParser<'a> {
}
b'[' => {
nest += 1;
if nest == MAX_LINK_NEST { return (0, 0, 0, 0); }
max_nest = cmp::max(max_nest, nest)
}
b']' => {

0 comments on commit c2ef772

Please sign in to comment.