rust-lang / rust-lang/mdBook

Simple way to modify the HTML output by the HTML renderer?

Open
#2,598 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

C-question
Dominant language
Rust
Stars
22.2k
Forks
1.9k
PR merge metrics
PR metrics pending

Description

Question

Hello, I need to make some custom modifications to the HTML generated by the HTML renderer before it is written to the HTML files, is there a simple way to do that?
I thought that I could just write another renderer and have mdBook call it after the HTML renderer, but it looks like the file writing logic is inside the HTML renderer, with no way to add some external transformer in between, and that the only way currently would be to write another full HTML renderer.

Is there some simpler way?
Thank you.

Version
mdbook v0.4.43

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the HTML renderer and the file-writing logic described in the issue, then trace how mdBook invokes renderers. Determine whether a supported transformation hook can be specified and define the expected behavior for modifying HTML before files are written.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
documentation, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.