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

version_sync fails to parse toml blocks when inside blockquotes #83

Closed
CreepySkeleton opened this issue Feb 10, 2020 · 2 comments · Fixed by #86
Closed

version_sync fails to parse toml blocks when inside blockquotes #83

CreepySkeleton opened this issue Feb 10, 2020 · 2 comments · Fixed by #86
Labels

Comments

@CreepySkeleton
Copy link

This part of a readme

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

fails with

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

I'm not sure if it's a bug in your crate or in pulldown-cmark.

As a workaround, would you be wiling to accept a PR that strips any leading > from toml blocks?

@mgeisler
Copy link
Owner

Thanks very much for reporting this! It's a bug in my library... I'm working on a fix right now.

@mgeisler mgeisler added the bug label Mar 30, 2020
mgeisler added a commit that referenced this issue Mar 30, 2020
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.
@CreepySkeleton
Copy link
Author

Thank you for the crate and the fix! It's very helpful 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants