badboy / mdbook-toc

A preprocessor for mdbook to add inline Table of Contents support.
Mozilla Public License 2.0
163 stars 20 forks source link

It fails with using Draft Chapters feature of mdBook #7

Closed kalindkaria closed 3 years ago

kalindkaria commented 3 years ago

Hi @badboy You might know that mdBook has the feature of having Draft Chapters with the pull request rust-lang/mdBook#1153. When I use this feature along with mdbook-toc, the preprocessor fails with the output below.

2020-09-23 02:52:42 [INFO] (mdbook::book): Book building has started
Unable to parse the input
2020-09-23 02:52:42 [ERROR] (mdbook::utils): Error: The preprocessor exited unsuccessfully

Do you know the reason of this issue? Kindly shed some light. Thanks.

badboy commented 3 years ago

mdbook-toc is currently build against mdbook 0.3 draft chapters seem to be in 0.4

So I guess it's just unable to parse that. Should be easy to do to upgrade the dependency, but I won't get to it before next week.

kalindkaria commented 3 years ago

Oh okay. Can you tell me how to do it at my local end? As I really need this feature in the docs I'm building for a project.

badboy commented 3 years ago

Update the version number here: https://github.com/badboy/mdbook-toc/blob/master/Cargo.toml#L12 Build it (hope it works), then run it (and hope it works)

kalindkaria commented 3 years ago

I did that and tried to built it, but it didn't compile due to the error below:

error[E0277]: the trait bound `std::string::String: std::error::Error` is not satisfied
   --> src/lib.rs:148:36
    |
148 |         .map_err(|err| Error::from(format!("Markdown serialization failed: {}", err)))
    |                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::error::Error` is not implemented for `std::string::String`
    |
    = note: required because of the requirements on the impl of `std::convert::From<std::string::String>` for `mdbook::errors::Error`
    = note: required by `std::convert::From::from`
    = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to previous error

For more information about this error, try `rustc --explain E0277`.
error: could not compile `mdbook-toc`.

I'm new to Rust language so I could understand that there's a type mismatching for the standard trait "Error" with the one called in lib.rs. Can you help me rectify it?

badboy commented 3 years ago

Can you help me rectify it?

Yes, next week.

badboy commented 3 years ago

Done in v0.5

kalindkaria commented 3 years ago

Done in v0.5

Thanks. 👍🏻