From 552e39c89766089899cf3345d3223d0b4511cbc2 Mon Sep 17 00:00:00 2001 From: Gambhiro Date: Fri, 23 Dec 2016 08:17:04 +0000 Subject: [PATCH] update example to encourage using book.toml --- book-example/book.json | 5 ----- book-example/book.toml | 3 +++ book-example/src/SUMMARY.md | 2 ++ book-example/src/cli/test.md | 2 +- book-example/src/format/config.md | 18 +++++++++--------- book-example/src/format/format.md | 2 +- book-example/src/format/theme/index-hbs.md | 2 +- .../src/format/theme/syntax-highlighting.md | 2 +- book-example/src/lib/lib.md | 2 +- book-example/src/misc/introduction.md | 3 +++ 10 files changed, 22 insertions(+), 19 deletions(-) delete mode 100644 book-example/book.json create mode 100644 book-example/book.toml create mode 100644 book-example/src/misc/introduction.md diff --git a/book-example/book.json b/book-example/book.json deleted file mode 100644 index aba0a400..00000000 --- a/book-example/book.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "title": "mdBook Documentation", - "description": "Create book from markdown files. Like Gitbook but implemented in Rust", - "author": "Mathieu David" -} diff --git a/book-example/book.toml b/book-example/book.toml new file mode 100644 index 00000000..cac456db --- /dev/null +++ b/book-example/book.toml @@ -0,0 +1,3 @@ +title = "mdBook Documentation" +description = "Create book from markdown files. Like Gitbook but implemented in Rust" +author = "Mathieu David" diff --git a/book-example/src/SUMMARY.md b/book-example/src/SUMMARY.md index ff3911c7..8d7bdcdd 100644 --- a/book-example/src/SUMMARY.md +++ b/book-example/src/SUMMARY.md @@ -1,5 +1,7 @@ # Summary +[Introduction](misc/introduction.md) + - [mdBook](README.md) - [Command Line Tool](cli/cli-tool.md) - [init](cli/init.md) diff --git a/book-example/src/cli/test.md b/book-example/src/cli/test.md index a7979f01..feeb4e9d 100644 --- a/book-example/src/cli/test.md +++ b/book-example/src/cli/test.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 diff --git a/book-example/src/format/config.md b/book-example/src/format/config.md index f7c7769b..bbea9a59 100644 --- a/book-example/src/format/config.md +++ b/book-example/src/format/config.md @@ -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 diff --git a/book-example/src/format/format.md b/book-example/src/format/format.md index fe4cda8f..35757252 100644 --- a/book-example/src/format/format.md +++ b/book-example/src/format/format.md @@ -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 diff --git a/book-example/src/format/theme/index-hbs.md b/book-example/src/format/theme/index-hbs.md index 3903da51..e509565a 100644 --- a/book-example/src/format/theme/index-hbs.md +++ b/book-example/src/format/theme/index-hbs.md @@ -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 \ 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. diff --git a/book-example/src/format/theme/syntax-highlighting.md b/book-example/src/format/theme/syntax-highlighting.md index ec4490a6..fe6b3654 100644 --- a/book-example/src/format/theme/syntax-highlighting.md +++ b/book-example/src/format/theme/syntax-highlighting.md @@ -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 diff --git a/book-example/src/lib/lib.md b/book-example/src/lib/lib.md index 4a67ed06..0f7a643d 100644 --- a/book-example/src/lib/lib.md +++ b/book-example/src/lib/lib.md @@ -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 } diff --git a/book-example/src/misc/introduction.md b/book-example/src/misc/introduction.md new file mode 100644 index 00000000..36495382 --- /dev/null +++ b/book-example/src/misc/introduction.md @@ -0,0 +1,3 @@ +# Introduction + +A frontmatter chapter.