update example to encourage using book.toml

This commit is contained in:
Gambhiro 2016-12-23 08:17:04 +00:00
parent 791487bc84
commit 552e39c897
10 changed files with 22 additions and 19 deletions

View File

@ -1,5 +0,0 @@
{
"title": "mdBook Documentation",
"description": "Create book from markdown files. Like Gitbook but implemented in Rust",
"author": "Mathieu David"
}

3
book-example/book.toml Normal file
View File

@ -0,0 +1,3 @@
title = "mdBook Documentation"
description = "Create book from markdown files. Like Gitbook but implemented in Rust"
author = "Mathieu David"

View File

@ -1,5 +1,7 @@
# Summary
[Introduction](misc/introduction.md)
- [mdBook](README.md)
- [Command Line Tool](cli/cli-tool.md)
- [init](cli/init.md)

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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.

View File

@ -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

View File

@ -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
}

View File

@ -0,0 +1,3 @@
# Introduction
A frontmatter chapter.