Skip to content

Added a way to hook into the serve process.#2620

Open
AdrienDerobert wants to merge 1 commit intorust-lang:masterfrom
AdrienDerobert:master
Open

Added a way to hook into the serve process.#2620
AdrienDerobert wants to merge 1 commit intorust-lang:masterfrom
AdrienDerobert:master

Conversation

@AdrienDerobert
Copy link

@AdrienDerobert AdrienDerobert commented Mar 26, 2025

Closes #2573
Added a way to hook into the serve process after the build.

mdbook serve -c <post build command>
# or
mdbook serve --post-build <post build command>

Tested on:

  • Linux
  • Windows
  • MacOs

Added a way to hook into the serve process after the build.
```
mdbook serve -c <post build command>
```
@rustbot rustbot added the S-waiting-on-review Status: waiting on a review label Mar 26, 2025
@szabgab
Copy link
Contributor

szabgab commented Mar 26, 2025

Thanks for the PR.

I also think we need a way to do this, but I thought it should be part of the configuration in the book.toml as it is more permanent. In which case would you prefer it to be a command-line flag?

In any case it would be better if there was a test that runs in the CI to check this feature.

@AdrienDerobert
Copy link
Author

I can add a configuration option for it in book.toml if you prefer. I was thinking on the easiest and quickest way to develop the feature and the cli flag for serve seemed the simplest to go. As for build you could easily run the build and your command/script right after. But if you prefer i can work a bit more on it to make it part of the configuration and add a test to the ci.

Just to make sure if it is in the book.toml it should also run in build.
Am i right ?

@AdrienDerobert
Copy link
Author

Another problem with including this in the book toml config is that the command might be different for a windows user and a user of a posix system. Do I introduce a section per platform to define the command ?

@AdrienDerobert
Copy link
Author

Hello did you have any indications on how to progress this forward what would be the best course of action ? Do i add a new configuration option or only the command line argument flag would suffice.

In my opinion the command line argument is enough because the feature is only needed for the serve sub command in order to hook into the watch and rebuild mechanism. But for build nothing prevents you from running the commands after the build yourself.

Or is it expected the build command to produce the final book with the post processing (eg: inclusion of extra HTML files) ?

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

Labels

S-waiting-on-review Status: waiting on a review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a way to ignore the source link file present in the SUMMARY.md while including the link.

3 participants