Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse TOML blocks inside blockquotes #86

Merged
merged 1 commit into from
Mar 30, 2020
Merged

Conversation

mgeisler
Copy link
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