Skip to content

Commit 7eb63bf

Browse files
authored
Merge pull request #2874 from ehuss/cmd-docs
Remove partially outdated CmdPreprocessor/CmdRenderer docs
2 parents fd88719 + 91842c3 commit 7eb63bf

File tree

2 files changed

+4
-42
lines changed
  • crates/mdbook-driver/src

2 files changed

+4
-42
lines changed

crates/mdbook-driver/src/builtin_preprocessors/cmd.rs

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,8 @@ use tracing::{debug, trace, warn};
88

99
/// A custom preprocessor which will shell out to a 3rd-party program.
1010
///
11-
/// # Preprocessing Protocol
12-
///
13-
/// When the `supports_renderer()` method is executed, `CmdPreprocessor` will
14-
/// execute the shell command `$cmd supports $renderer`. If the renderer is
15-
/// supported, custom preprocessors should exit with a exit code of `0`,
16-
/// any other exit code be considered as unsupported.
17-
///
18-
/// The `run()` method is implemented by passing a `(PreprocessorContext, Book)`
19-
/// tuple to the spawned command (`$cmd`) as JSON via `stdin`. Preprocessors
20-
/// should then "return" a processed book by printing it to `stdout` as JSON.
21-
/// For convenience, the `CmdPreprocessor::parse_input()` function can be used
22-
/// to parse the input provided by `mdbook`.
23-
///
24-
/// Exiting with a non-zero exit code while preprocessing is considered an
25-
/// error. `stderr` is passed directly through to the user, so it can be used
26-
/// for logging or emitting warnings if desired.
27-
///
28-
/// # Examples
29-
///
30-
/// An example preprocessor is available in this project's `examples/`
31-
/// directory.
11+
/// See <https://rust-lang.github.io/mdBook/for_developers/preprocessors.html>
12+
/// for a description of the preprocessor protocol.
3213
#[derive(Debug, Clone, PartialEq)]
3314
pub struct CmdPreprocessor {
3415
name: String,

crates/mdbook-driver/src/builtin_renderers/mod.rs

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,27 +14,8 @@ mod markdown_renderer;
1414

1515
/// A generic renderer which will shell out to an arbitrary executable.
1616
///
17-
/// # Rendering Protocol
18-
///
19-
/// When the renderer's `render()` method is invoked, `CmdRenderer` will spawn
20-
/// the `cmd` as a subprocess. The `RenderContext` is passed to the subprocess
21-
/// as a JSON string (using `serde_json`).
22-
///
23-
/// > **Note:** The command used doesn't necessarily need to be a single
24-
/// > executable (i.e. `/path/to/renderer`). The `cmd` string lets you pass
25-
/// > in command line arguments, so there's no reason why it couldn't be
26-
/// > `python /path/to/renderer --from mdbook --to epub`.
27-
///
28-
/// Anything the subprocess writes to `stdin` or `stdout` will be passed through
29-
/// to the user. While this gives the renderer maximum flexibility to output
30-
/// whatever it wants, to avoid spamming users it is recommended to avoid
31-
/// unnecessary output.
32-
///
33-
/// To help choose the appropriate output level, the `MDBOOK_LOG` environment
34-
/// variable will be passed through to the subprocess, if set.
35-
///
36-
/// If the subprocess wishes to indicate that rendering failed, it should exit
37-
/// with a non-zero return code.
17+
/// See <https://rust-lang.github.io/mdBook/for_developers/backends.html>
18+
/// for a description of the renderer protocol.
3819
#[derive(Debug, Clone, PartialEq)]
3920
pub struct CmdRenderer {
4021
name: String,

0 commit comments

Comments
 (0)