Skip to content
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

Preprocessor cannot add folders/files directly to book directory #1222

Open
niko-dunixi opened this issue May 13, 2020 · 1 comment
Open
Labels
A-Preprocessor Area: Preprocessors

Comments

@niko-dunixi
Copy link

Hello!

I'm implementing a preprocessor that generates plantuml diagrams. It extracts codeblocks with the plantuml language, renders the SVG, and then places a markdown element to reference the image.

While I write my mdbook with mdbook serve I'm finding that I must place these rendered files in the src directory in order for them to appear in the book directory. If my preprocessor tries to put these files into the book path directly, they're immediately nuked.

Is there a way to programmatically tell mdbook that these dynamically created files are valid so they're not removed?

@niko-dunixi niko-dunixi changed the title Preprocessor cannot add folders/files directly to build directory Preprocessor cannot add folders/files directly to book directory May 13, 2020
@ehuss ehuss added the A-Preprocessor Area: Preprocessors label May 18, 2020
@auser
Copy link

auser commented Nov 15, 2021

I would absolutely love the ability to update the book.toml within a preprocessor. @ehuss commented on my issue #1687

I am able to update it within a preprocessor, just cannot find a way to reassign the current context to a new context address.

daprilik added a commit to microsoft/openvmm that referenced this issue Oct 30, 2024
Closes #150.

This PR adds infrastructure to support using mdbook plugins when
compiling the OpenVMM guide.
To get started, I added support for two particularly useful plugins:
`mdbook-admonish` and `mdbook-mermaid`.

I also quickly skimmed through the guide, and switched over a bunch of
ad-hoc `> NOTE` blocks over to using admonishments, which really spruced
up the Guide.

For example:


![image](https://github.com/user-attachments/assets/2e825687-572a-4616-abdf-05c35c6a1fa6)

...turns into


![image](https://github.com/user-attachments/assets/33de2faf-9739-4642-9c95-a84223697e5c)

* * *

The approach I've taken to integrate these plugins is a _little_
unorthodox, as I really didn't want to check in big blobs of minified JS
and CSS right into our repo.

Instead, I've written a small openvmm-specific "shim" preprocessor,
which works around rust-lang/mdBook#1222 by
dynamically invoking the plugins's `install` subcommands as part of the
build, and adding the injected artifacts to the Guide's `.gitignore` to
ensure they aren't committed during local dev.

In addition, the shim lets `flowey` override the command path to the
various preprocessors, precluding the need to install those binaries
into the user / CI machine's $PATH.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Preprocessor Area: Preprocessors
Projects
None yet
Development

No branches or pull requests

3 participants