You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 9, 2023. It is now read-only.
Here is the documentation on GitBook plugins: https://toolchain.gitbook.com/plugins/create.html
The way this one of mine is implemented is by running some regex replacements against the pre-rendered and post-rendered markdown comment. The whole implementation is just a few lines of JavaScript.
I would be interested in having the same capability to run snippets of logic against my pre-rendered and post-rendered rustdoc. I would like to have a Cargo subcommand:
cargo plugin-doc
which forwards to cargo doc but executes plugins before (on the Markdown) and after (on the HTML).
Plugins would be listed as metadata in Cargo.toml:
Plugins would be installed as ordinary binaries like cargo install rustdoc-plugin-playground-links. This project also involves developing the library for writing plugins. Mirroring the GitBook system, plugin code might look something like:
use rustdoc_plugin::{Page,Plugin};structPlaygroundLinksPlugin;// Both functions are optional and do nothing by default, so you can// implement just one or the other.implPluginforPlaygroundLinksPlugin{fnpage_before(page:&mutPage){/* ... */}fnpage_after(page:&mutPage){/* ... */}}fnmain(){
rustdoc_plugin::main(PlaygroundLinksPlugin);}
The text was updated successfully, but these errors were encountered:
In the GitBook that backs https://serde.rs, I use several GitBook plugins, a few of which I wrote myself.
For example I have a plugin that lets me insert playground links into code blocks. Here is an invocation right from the homepage: markdown (shown below) and rendered here with the "Run" link.
Similarly a file name plugin -- markdown here and rendered here.
Here is the documentation on GitBook plugins: https://toolchain.gitbook.com/plugins/create.html
The way this one of mine is implemented is by running some regex replacements against the pre-rendered and post-rendered markdown comment. The whole implementation is just a few lines of JavaScript.
I would be interested in having the same capability to run snippets of logic against my pre-rendered and post-rendered rustdoc. I would like to have a Cargo subcommand:
which forwards to
cargo doc
but executes plugins before (on the Markdown) and after (on the HTML).Plugins would be listed as metadata in Cargo.toml:
Plugins would be installed as ordinary binaries like
cargo install rustdoc-plugin-playground-links
. This project also involves developing the library for writing plugins. Mirroring the GitBook system, plugin code might look something like:The text was updated successfully, but these errors were encountered: