update example to encourage using book.toml
This commit is contained in:
parent
791487bc84
commit
552e39c897
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
"title": "mdBook Documentation",
|
||||
"description": "Create book from markdown files. Like Gitbook but implemented in Rust",
|
||||
"author": "Mathieu David"
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
title = "mdBook Documentation"
|
||||
description = "Create book from markdown files. Like Gitbook but implemented in Rust"
|
||||
author = "Mathieu David"
|
|
@ -1,5 +1,7 @@
|
|||
# Summary
|
||||
|
||||
[Introduction](misc/introduction.md)
|
||||
|
||||
- [mdBook](README.md)
|
||||
- [Command Line Tool](cli/cli-tool.md)
|
||||
- [init](cli/init.md)
|
||||
|
|
|
@ -10,7 +10,7 @@ mdBook supports a `test` command that will run all available tests in mdBook. At
|
|||
- checking for unused files
|
||||
- ...
|
||||
|
||||
In the future I would like the user to be able to enable / disable test from the `book.json` configuration file and support custom tests.
|
||||
In the future I would like the user to be able to enable / disable test from the `book.toml` configuration file and support custom tests.
|
||||
|
||||
**How to use it:**
|
||||
```bash
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
# Configuration
|
||||
|
||||
You can configure the parameters for your book in the ***book.json*** file.
|
||||
You can configure the parameters for your book in the ***book.toml*** file.
|
||||
|
||||
Here is an example of what a ***book.json*** file might look like:
|
||||
We encourage using the TOML format, but JSON is also recognized and parsed.
|
||||
|
||||
```json
|
||||
{
|
||||
"title": "Example book",
|
||||
"author": "Name",
|
||||
"description": "The example book covers examples.",
|
||||
"dest": "output/my-book"
|
||||
}
|
||||
Here is an example of what a ***book.toml*** file might look like:
|
||||
|
||||
```toml
|
||||
title = "Example book"
|
||||
author = "Name"
|
||||
description = "The example book covers examples."
|
||||
dest = "output/my-book"
|
||||
```
|
||||
|
||||
#### Supported variables
|
||||
|
|
|
@ -4,5 +4,5 @@ In this section you will learn how to:
|
|||
|
||||
- Structure your book correctly
|
||||
- Format your `SUMMARY.md` file
|
||||
- Configure your book using `book.json`
|
||||
- Configure your book using `book.toml`
|
||||
- Customize your theme
|
||||
|
|
|
@ -19,7 +19,7 @@ Here is a list of the properties that are exposed:
|
|||
|
||||
- ***language*** Language of the book in the form `en`. To use in <code class="language-html">\<html lang="{{ language }}"></code> for example.
|
||||
At the moment it is hardcoded.
|
||||
- ***title*** Title of the book, as specified in `book.json`
|
||||
- ***title*** Title of the book, as specified in `book.toml`
|
||||
|
||||
- ***path*** Relative path to the original markdown file from the source directory
|
||||
- ***content*** This is the rendered markdown.
|
||||
|
|
|
@ -47,7 +47,7 @@ Will render as
|
|||
# }
|
||||
```
|
||||
|
||||
**At the moment, this only works for code examples that are annotated with `rust`. Because it would collide with semantics of some programming languages. In the future, we want to make this configurable through the `book.json` so that everyone can benefit from it.**
|
||||
**At the moment, this only works for code examples that are annotated with `rust`. Because it would collide with semantics of some programming languages. In the future, we want to make this configurable through the `book.toml` so that everyone can benefit from it.**
|
||||
|
||||
|
||||
## Improve default theme
|
||||
|
|
|
@ -13,7 +13,7 @@ fn main() {
|
|||
let mut book = MDBook::new(Path::new("my-book")) // Path to root
|
||||
.set_src(Path::new("src")) // Path from root to source directory
|
||||
.set_dest(Path::new("book")) // Path from root to output directory
|
||||
.read_config(); // Parse book.json file for configuration
|
||||
.read_config(); // Parse book.toml or book.json file for configuration
|
||||
|
||||
book.build().unwrap(); // Render the book
|
||||
}
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
# Introduction
|
||||
|
||||
A frontmatter chapter.
|
Loading…
Reference in New Issue