boozook / mdbook-svgbob Goto Github PK
View Code? Open in Web Editor NEWSvgBob mdbook preprocessor which swaps code-blocks with neat SVG.
License: Mozilla Public License 2.0
SvgBob mdbook preprocessor which swaps code-blocks with neat SVG.
License: Mozilla Public License 2.0
I had this working earlier on a very basic mdbook, then I added a bunch of content and now I'm stuck here -- beginning investigation, and will post as I try.
repo is here:
https://github.com/elasticdotventures/fungiblefarm-dots
2022-06-08 14:46:33 [INFO] (mdbook::book): Book building has started
[2022-06-08T04:46:33Z ERROR mdbook_svgbob] Unable to parse the input
2022-06-08 14:46:33 [WARN] (mdbook::preprocess::cmd): Error writing the RenderContext to the backend, Broken pipe (os error 32)
2022-06-08 14:46:33 [ERROR] (mdbook::utils): Error: The "svgbob" preprocessor exited unsuccessfully with exit status: 1 status
Rust toolchain: 1.67.0
https://github.com/HollowMan6/mdbook-pdf/actions/runs/4134900407/jobs/7146633379
Compiling mdbook-svgbob v0.2.1
error[E0277]: the trait bound `Cfg: From<&toml::map::Map<std::string::String, toml::value::Value>>` is not satisfied
--> /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/mdbook-svgbob-0.2.1/src/preprocessor.rs:58:38
|
58 | ... .and_then(|map| map.try_into().map_err(|err| error!("{}", err)).ok())
| ^^^ -------- required by a bound introduced by this call
| |
| the trait `From<&toml::map::Map<std::string::String, toml::value::Value>>` is not implemented for `Cfg`
|
= note: required for `&toml::map::Map<std::string::String, toml::value::Value>` to implement `Into<Cfg>`
= note: required for `Cfg` to implement `TryFrom<&toml::map::Map<std::string::String, toml::value::Value>>`
= note: required for `&toml::map::Map<std::string::String, toml::value::Value>` to implement `TryInto<Cfg>`
For more information about this error, try `rustc --explain E0[277](https://github.com/HollowMan6/mdbook-pdf/actions/runs/4134900407/jobs/7146633379#step:6:278)`.
error: could not compile `mdbook-svgbob` due to previous error
Hi.
This crate seems to be unmaintained. Would you like to give away maintainership? I would love to at least passively maintain this, especially after bringing it up to date with the currrent mdbook version!
Please feel free to transfer this repository to me and give me write access to crates.io!
I got a PR from @nofurtherinformation to fix the diagram colors when a dark theme is used in mdbook: google/comprehensive-rust#48.
The problem is that the diagrams use black as the text color โ even when the background color is very dark.
The fix is simply to include a style sheet with
svg text {
fill: var(--fg);
}
I'm not sure where the right place is to add such a CSS rule since mdbook-svgbob
is a preprocessor. Perhaps it could be a style="fill: var(--fg)"
attribute instead somewhere on the generated SVG?
Thanks for your work and the cool project! :)
I just recognized that the git tag is missing for the already on crates.io released v0.2.0 version and therefore also the precompiled binaries that you normally build and attach to a github release.
I would really appreciate this, as to fetch the binaries from the github release is a fast way to install the plugin (especially in the CI) without going through the rust compilation process.
attempted to update some of the libraries in Cargo.toml to latest versions .. specifically:
[dependencies]
-mdbook = "0.3"
-svgbob = "0.4"
-svg = "0.7"
+mdbook = "0.4.18"
+svgbob = "0.6.6"
+svg = "0.10.0"
-clap = "2.33"
+clap = "3.1.18"
log = "0.4"
-env_logger = "0.7"
-semver = "0.9.0"
+env_logger = "0.9.0"
+semver = "1.0.9"
toml = "0.5"
serde = "1.0"
serde_json = "1.0"
-pulldown-cmark = "0.7"
-pulldown-cmark-to-cmark = "3.0"
+pulldown-cmark = "0.9.1"
+pulldown-cmark-to-cmark = "10.0.1"
errors generated:
Compiling mdbook-svgbob v0.1.1 (/home/xxx/fungiblefarm-dots/mdbook-svgbob)
error[E0432]: unresolved import pulldown_cmark_to_cmark::fmt::cmark
--> src/preprocessor.rs:70:6
|
70 | use pulldown_cmark_to_cmark::fmt::cmark;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no cmark
in fmt
error[E0432]: unresolved import svgbob::Grid
--> src/svgbob.rs:5:5
|
5 | use svgbob::Grid;
| ^^^^^^^^^^^^ no Grid
in the root
error[E0603]: module fmt
is private
--> src/preprocessor.rs:70:31
|
70 | use pulldown_cmark_to_cmark::fmt::cmark;
| ^^^ private module
|
note: the module fmt
is defined here
--> /home/xxx/.cargo/registry/src/github.com-1ecc6299db9ec823/pulldown-cmark-to-cmark-10.0.1/src/lib.rs:5:5
|
5 | fmt,
| ^^^
warning: use of deprecated struct clap::App
: Replaced with Command
--> src/main.rs:10:12
|
10 | use clap::{App, Arg, ArgMatches, SubCommand};
| ^^^
|
= note: #[warn(deprecated)]
on by default
warning: use of deprecated struct clap::SubCommand
: Replaced with Command::new
unless you intended the Subcommand
trait
--> src/main.rs:10:34
|
10 | use clap::{App, Arg, ArgMatches, SubCommand};
| ^^^^^^^^^^
warning: use of deprecated struct clap::App
: Replaced with Command
--> src/main.rs:28:5
|
28 | Ok(App::new(NAME).version(VERSION)
| ^^^
warning: use of deprecated struct clap::SubCommand
: Replaced with Command::new
unless you intended the Subcommand
trait
--> src/main.rs:32:9
|
32 | SubCommand::with_name("supports")
| ^^^^^^^^^^
error[E0107]: this struct takes 0 lifetime arguments but 1 lifetime argument was supplied
--> src/main.rs:25:29
|
25 | pub fn init_cli() -> Result<ArgMatches<'static>> {
| ^^^^^^^^^^--------- help: remove these generics
| |
| expected 0 lifetime arguments
|
note: struct defined here, with 0 lifetime parameters
--> /home/xxx/.cargo/registry/src/github.com-1ecc6299db9ec823/clap-3.1.18/src/parse/matches/arg_matches.rs:70:12
|
70 | pub struct ArgMatches {
| ^^^^^^^^^^
Some errors have detailed explanations: E0107, E0432, E0603.
For more information about an error, try rustc --explain E0107
.
warning: mdbook-svgbob
(bin "mdbook-svgbob") generated 4 warnings
error: could not compile mdbook-svgbob
due to 4 previous errors; 4 warnings emitted
Hey, thanks for the preprocessor!
I've noticed that mdbook-graphviz requires a process
flag to be present before processing them as graphviz diagrams:
```dot process
digraph {
processed -> graph
}
```
Just as a matter of 'preprocessor hygiene', it would be really cool if mdbook-svgbob
did similar! This would mean you could talk about bob
documents as well as processing them as SVGs. I realise this is a breaking change though.
andadac@HP-BSPARK:~/repos/comprehensive-rust$ cargo install mdbook-svgbob
Updating crates.io index
Installing mdbook-svgbob v0.2.1
Updating crates.io index
Compiling proc-macro2 v1.0.66
Compiling unicode-ident v1.0.11
Compiling autocfg v1.1.0
Compiling libc v0.2.147
...
Compiling pulldown-cmark-to-cmark v10.0.4
Compiling toml v0.5.11
Compiling svg v0.12.1
Compiling mdbook-svgbob v0.2.1
error[E0277]: the trait bound Cfg: From<&toml::map::Map<std::string::String, toml::value::Value>>
is not satisfied
--> /home/andadac/.cargo/registry/src/index.crates.io-6f17d22bba15001f/mdbook-svgbob-0.2.1/src/preprocessor.rs:58:42
|
58 | ... .and_then(|map| map.try_into().map_err(|err| error!("{}", err)).ok())
| ^^^^^^^^ the trait From<&toml::map::Map<std::string::String, toml::value::Value>>
is not implemented for Cfg
|
= note: required for &toml::map::Map<std::string::String, toml::value::Value>
to implement Into<Cfg>
= note: required for Cfg
to implement TryFrom<&toml::map::Map<std::string::String, toml::value::Value>>
= note: required for &toml::map::Map<std::string::String, toml::value::Value>
to implement TryInto<Cfg>
For more information about this error, try rustc --explain E0277
.
error: could not compile mdbook-svgbob
(bin "mdbook-svgbob") due to previous error
error: failed to compile mdbook-svgbob v0.2.1
, intermediate artifacts can be found at /tmp/cargo-installWvoAme
cd
in WSL2, after sudo-apt update, upgrade, rustup update, install mdbook done
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.