Skip to content

Parse TOML blocks inside blockquotes#86

Merged
mgeisler merged 1 commit into
masterfrom
fix-blockquote-codeblock
Mar 30, 2020
Merged

Parse TOML blocks inside blockquotes#86
mgeisler merged 1 commit into
masterfrom
fix-blockquote-codeblock

Conversation

@mgeisler
Copy link
Copy Markdown
Owner

If a TOML block was found inside a Markdown blockquote, we would
report a TOML parse error. This is because we extracted the code block
directly from the original text and thus incorrectly included the >
characters.

So parsing

> This is a blockquote
>
> ```toml
> clap = { git = "https://github.com/clap-rs/clap/" }
> ```

would result in an error like this:

README.md (line 22) ... TOML parse error: unexpected character
found: > at line 1 column 1 in

> clap = { git = "https://github.com/clap-rs/clap/" }

To fix this, we now parse the code blocks by listening to the Start
and End events from pulldown-cmark. This should be much more
robust.

Fixes #83.

If a TOML block was found inside a Markdown blockquote, we would
report a TOML parse error. This is because we extracted the code block
directly from the original text and thus incorrectly included the `>`
characters.

So parsing

~~~
> This is a blockquote
>
> ```toml
> clap = { git = "https://github.com/clap-rs/clap/" }
> ```
~~~

would result in an error like this:

> README.md (line 22) ... TOML parse error: unexpected character
>  found: `>` at line 1 column 1 in
>
> `> clap = { git = "https://github.com/clap-rs/clap/" }`

To fix this, we now parse the code blocks by listening to the `Start`
and `End` events from `pulldown-cmark`. This should be much more
robust.

Fixes #83.
@mgeisler mgeisler merged commit 33b3bcf into master Mar 30, 2020
@mgeisler mgeisler deleted the fix-blockquote-codeblock branch February 14, 2021 16:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

version_sync fails to parse toml blocks when inside blockquotes

1 participant