-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Break out the core book from everything else #1234
Comments
I think it would be great to have a more stripped-down core library. I'm uncertain if it is necessary to make it a separate crate. My concern is that adds some maintenance overhead. Would it be OK to just use features more aggressively? I assume the main dependencies to avoid are:
That seems relatively easy to make those optional, default features. |
I think the biggest offenders are all the extras used by the binary, and the HTML renderer. For example, a library doesn't actually need to instantiate a logger ( From what I can tell the only thing you really need for the
I'm not sold on this... We use workspaces a lot to keep compile times down and maintain separation in work projects and in practice it's no different from putting things into modules, they're just different folders on disc. Tools like
I've found using more than one or two feature flags in a crate tends to make things harder to maintain. It clutters the code a lot, and you've got to be careful to try different permutations of feature flags in case one feature accidentally uses something that only exists with another feature. Often you'll just run This weekend I'll do an experiment to see what the bare minimum in terms of functionality and dependencies is needed for using |
I did a proof-of-concept in #1937 to see how many dependencies I could strip away while enabling my mdbook-quiz preprocessor to still work. I removed:
|
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:Book
type and things it contains (BookItem
,Chapter
, etc.)SUMMARY.md
parser and related code for loading a book from diskRenderer
traitPreprocessor
traitCmdRenderer
- because it only requiresstd
and we'll already be pulling inserde
This then opens the way for making the HTML renderer just another renderer (e.g. by installing a
mdbook-html
binary alongsidemdbook
).It's quite a big change in terms of work and backwards compatibility (although we could probably re-export items from
mdbook-core
inmdbook
?) 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?
The text was updated successfully, but these errors were encountered: