-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Add support for alternative backends #507
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
Add support for alternative backends #507
Conversation
95682e3
to
3e62ba2
Compare
Just an update on this, I've started writing up the "protocol" we'll be using for alternate backends and added it to the user guide. |
Alongside this I've started an experimental alternate backend, mdbook-epub, to see how ergonomic the "alternate backends" design is. So far I like how backends can be discovered at runtime (meaning I don't have to patch At the moment I'm confident the general idea is sound, so the next step is to flesh out the It would also be nice to move the |
186d634
to
22b28e2
Compare
I've also started work on a I was originally thinking that As a datapoint, the Rust cookbook already uses From my experience implementing the experimental On the other hand, using subprocesses and passing in the input via stdin is a quite robust, meaning a dodgy backend can't crash the entire application, and the JSON format allows a bit of flexibility in that you can still use an old plugin with a newer version of There are still a couple outstanding questions that need to be resolved, but it looks like this backend design will be present in the next major version of |
0f7fdd4
to
96f9faf
Compare
1bea39f
to
5ed8cbf
Compare
I've gone back through the PR and I believe this is about ready to merge 🎉 The next big internals task is to do a big rewrite of the HTML renderer. At the moment it's quite messy and convoluted, and has accumulated a lot of technical debt as bits and pieces get added by different contributors. With a much more organised renderer, things like #468 should just fall out, and it'll be a lot easier to resolve merge conflicts in #472. I mean you'll still have to rewrite the stuff hooked into the renderer, but that would have had to happen anyway and it's easier to fix with a cleaner design. |
* Added a mechanism for creating alternate backends * Added a CmdRenderer and the ability to have multiple renderers * Made MDBook::load() autodetect renderers * Added a couple methods to RenderContext * Converted RenderContext.version to a String * Made sure all alternate renderers are invoked as `mdbook-*` * Factored out the logic for determining which renderer to use * Added tests for renderer detection * Made it so `mdbook test` works on the book-example again * Updated the "For Developers" docs * Removed `[output.epub]` from the example book's book.toml * Added a bit more info on how backends should work * Added a `destination` key to the RenderContext * Altered how we wait for an alternate backend to finish * Refactored the Renderer trait to not use MDBook and moved livereload to the template * Moved info for developers out of the book.toml format chapter * MOAR docs * MDBook::build() no longer takes &mut self * Replaced a bunch of println!()'s with proper log macros * Cleaned up the build() method and backend discovery * Added a couple notes and doc-comments * Found a race condition when backends exit really quickly * Added support for backends with arguments * Fixed a funny doc-comment
This PR adds support for having alternative (and multiple) backends.
fixes #149