Skip to content

Break out the core book from everything else #1234

Open
@Michael-F-Bryan

Description

@Michael-F-Bryan

In the same vein as #1211 and #1076, a massive pain point when developing plugins is that you need to import mdbook (which is fine) and this pulls in half of crates.io as transitive dependencies (which is not).

My thoughts are we could have a mdbook-core crate containing the bare minimum needed to load a book from disk, plus common traits:

  • the Book type and things it contains (BookItem, Chapter, etc.)
  • the SUMMARY.md parser and related code for loading a book from disk
  • the Renderer trait
  • the Preprocessor trait
  • the CmdRenderer - because it only requires std and we'll already be pulling in serde

This then opens the way for making the HTML renderer just another renderer (e.g. by installing a mdbook-html binary alongside mdbook).

It's quite a big change in terms of work and backwards compatibility (although we could probably re-export items from mdbook-core in mdbook?) and I'm happy with doing most of the grunt work, but thought I'd get some thoughts before making changes.

Does this seem like a reasonable idea? Or would it just be a bunch of busy work which is going to break a lot of in-flight PRs and waste time?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Breaking ChangeThis would require a SemVer breaking changeC-refactorCategory: Code refactoring

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions