Skip to content

Expose mdbook as a Library #2954

Open

Description

@UebelAndre

Problem

Howdy, I would like to include the mdbook binary in some tooling and due to rust-lang/cargo#9096 not yet being stabilized, getting access to the mdbook binary is pretty tricky after the 0.5.0 release and requires additional infrastructure or extra complex scripting to make sure it's available.

Proposed Solution

Would it be acceptable by the maintainers to make src/main.rs into a library where the only public function is main?

Notes

This used to work prior to the 0.5.0 release but now the existing tooling would require a nightly toolchain.

Activity

  1. added
    C-enhancement
    on Nov 20, 2025
  2. ehuss commented on Nov 20, 2025

    @ehuss
    Contributor

    Can you say more about what your usecase is? Almost everything should be available via mdbook-driver. That is the library that is intended for high-level usage.

  3. UebelAndre commented on Nov 20, 2025

    @UebelAndre
    Author

    I maintain https://bazelbuild.github.io/rules_rust/rust_mdbook.html which are Bazel rules that wrap mdbook. Currently mdbook is built from source by default using additional infra in the same repository. Because there is no library in the current mdbook crate, I get hit by rust-lang/cargo#9096 and now need to re-implement the entry-point on my own. I had a similar issue with wasm-bindgen wasm-bindgen/wasm-bindgen#4653

  4. UebelAndre commented on Nov 22, 2025

    @UebelAndre
    Author

    I'd also be happy to do the work to make this happen. I'd just need a maintainer to give the go-ahead. I understand, however, it's an odd scenario.

  5. UebelAndre commented on Mar 25, 2026

    @UebelAndre
    Author

    @ehuss friendly ping on this. Happy to do any work/investigations 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions