rust-lang / mdBook

Create book from markdown files. Like Gitbook but implemented in Rust
https://rust-lang.github.io/mdBook/
Mozilla Public License 2.0
18.45k stars 1.65k forks source link

Extract cor estructs and enums into a library, for use by preprocessors and output generators #2492

Closed hoijui closed 6 days ago

hoijui commented 6 days ago

Problem

I ran cargo install mdbook-reading-time, and while this utility just parses JSON, counts words and multiplies that number with an other one, it had to download and compile over 250 dependencies to do that. I imagine the situation is similar with most pre-processors and output generators, as most will probably want to use the parsing and serializing code that already comes with mdbook (if they are written in Rust).

When listing mdbook as a dependency in such projects, one can disable the default features, yet the big bulk of the tool will still be included.

This wastes human life time (waiting for the compilation), energy, storage space and network bandwidth.

related: https://github.com/pawurb/mdbook-reading-time/issues/1

Proposed Solution

Extract the structs and enums that are required for the JSON parsing and serializing of the data sent to and from pre-processors and output generators into a separate library.

Notes

No response

ehuss commented 6 days ago

Thanks for the report! I believe this is mostly a duplicate of #1234, so closing in favor of that. It is a relatively high priority item for me.