I'm trying to figure out how to use the include_mdbook crate, but the documentation is very very slim.
I am running dx serve from dx 0.6.0-alpha.2.
How can I create a basic example to embed one page of an mdbook into the frontpage of a Dioxus project? Here is what I tried (assume /docs/en/my-page.md exists from project root):
// main.rs
use dioxus::prelude::*;
use mdbook_macro::mdbook_router;
mdbook_router! {"docs"}
fn main() {
launch(App);
}
fn App() -> Element {
rsx! {
div {
h1 { "My Dioxus App with mdBook" }
MyPage {}
}
}
}
// Cargo.toml
[package]
... // personal info
[dependencies]
serde = { version = "1.0.197", features = ["derive"] }
dioxus = { git = "https://github.com/dioxuslabs/dioxus", features = [
"fullstack",
"router",
] }
use-mdbook = { git = "https://github.com/dioxuslabs/include_mdbook" }
mdbook-macro = { git = "https://github.com/dioxuslabs/include_mdbook" }
[features]
default = []
server = ["dioxus/axum"]
web = ["dioxus/web"]
However, I'm getting this odd error:
error[E0061]: this function takes 5 arguments but 6 arguments were supplied
--> src/main.rs:7:1
|
7 | mdbook_router! {"docs"}
| ^^^^^^^^^^^^^^^^^^^^^^^
| |
| unexpected argument #1 of type `&'static str`
| in this macro invocation
|
::: /home/sebastian/.cargo/git/checkouts/include_mdbook-2ad776093e36b384/dfd4a72/mdbook-macro/src/lib.rs:20:1
|
20 | pub fn mdbook_router(input: TokenStream) -> TokenStream {
| ------------------------------------------------------- in this expansion of `mdbook_router!`
|
note: associated function defined here
--> /home/sebastian/.cargo/git/checkouts/dioxus-1e619ce595d3799d/20d146d/packages/core/src/hotreload_utils.rs:340:12
|
340 | pub fn new(
| ^^^
I don't entirely understand, since I'm using the macro as shown in the examples of include_mdbook