diff --git a/book-example/book/README.html b/book-example/book/README.html new file mode 100644 index 00000000..34e918e4 --- /dev/null +++ b/book-example/book/README.html @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + +
+ + + +
+

mdBook

+

mdBook is a command line tool and Rust library to create books using Markdown. +It's very similar to Gitbook but written in Rust.

+

This book serves as an example of the output of mdBook and as the docs at the same time.

+

mdBook is free and open source, you can find the source code on Github. +Issues and feature requests can be posted on the Github Issue tracker.

+

License

+

mdBook, all the code and this book, are released under the Mozilla Public License v2.0

+ +
+ +
+ + + + + diff --git a/book-example/book/book.css b/book-example/book/book.css new file mode 100644 index 00000000..2c93872a --- /dev/null +++ b/book-example/book/book.css @@ -0,0 +1,150 @@ +html, body { + font-family: "Open Sans", sans-serif; + color: #333; +} + + +.sidebar { + position: absolute; + left: 0; + top: 0; + bottom: 0; + width: 300px; + overflow-y: auto; + border-right: 1px solid rgba(0, 0, 0, 0.07); + padding: 10px 10px; + font-size: 14px; + box-sizing: border-box; + -webkit-overflow-scrolling: touch; + background-color: #fafafa; + color: #364149; + + /* Animation: slide away */ + -webkit-transition: left 0.5s; /* Safari */ + -o-transition: left 0.5s; /* Opera */ + -moz-transition: left 0.5s; /* Mozilla Firefox */ + transition: left 0.5s; +} + +.page-wrapper { + position: absolute; + overflow-y: auto; + left: 315px; + right: 0; + top: 0; + bottom: 0; + box-sizing: border-box; + background: none repeat scroll 0 0 #FFF; + -webkit-overflow-scrolling: touch; + + /* Animation: slide away */ + -webkit-transition: left 0.5s; /* Safari */ + -o-transition: left 0.5s; /* Opera */ + -moz-transition: left 0.5s; /* Mozilla Firefox */ + transition: left 0.5s; +} + +@media only screen and (max-width: 1060px) { + .sidebar { + left: -300px; + } + .page-wrapper { + left: 15px; + padding-right: 15px; + } +} + +.page { + margin-left: auto; + margin-right:auto; + max-width: 750px; + padding-bottom: 50px; +} + +.chapter { + list-style: none outside none; + padding-left: 0; + line-height: 30px; +} + +.section { + list-style: none outside none; + padding-left: 20px; + line-height: 40px; +} + +.section li { + text-overflow: ellipsis; + overflow: hidden; + white-space: nowrap; +} + +.chapter li { + color: #AAA; +} + +.chapter li a { + color: #333; + padding: 5px 0; + text-decoration: none; +} + +.chapter li .active { + color: #008cff; +} + +.chapter li a:hover { + /* Animate color change */ + color: #008cff; + text-decoration: none; +} + +.menu-bar { + height: 50px; + color: #CCC; +} + +.menu-bar i { + -webkit-transition: color 0.5s; /* Safari */ + -o-transition: color 0.5s; /* Opera */ + -moz-transition: color 0.5s; /* Mozilla Firefox */ + transition: color 0.5s; +} + +.menu-bar :hover { + /* Animate color change */ + color: #333; +} + +pre { + padding: 16px; + overflow: auto; + font-size: 85%; + line-height: 1.45; + background-color: #f7f7f7; + border: 0; + border-radius: 3px; +} + +.nav-previous-next { + margin-top: 60px; +} + +.left { + float: left; +} + +.right { + float: right; +} + +/* Content */ + +.page a { + color: #4183c4; + text-decoration: none; +} + +.page a:hover { + text-decoration: underline; +} diff --git a/book-example/book/book.js b/book-example/book/book.js new file mode 100644 index 00000000..643755e5 --- /dev/null +++ b/book-example/book/book.js @@ -0,0 +1,17 @@ +$( document ).ready(function() { + + // Interesting DOM Elements + var sidebar = $("#sidebar"); + var page_wrapper = $("#page-wrapper"); + + $("#sidebar-toggle").click(function(event){ + if(sidebar.position().left === 0){ + sidebar.css({left: "-300px"}); + page_wrapper.css({left: "15px"}); + } else { + sidebar.css({left: "0"}); + page_wrapper.css({left: "315px"}); + } + }); + +}); diff --git a/book-example/book/cli/build.html b/book-example/book/cli/build.html new file mode 100644 index 00000000..36601a07 --- /dev/null +++ b/book-example/book/cli/build.html @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + +
+ + + +
+

The build command

+

The build command is used to render your book:

+
mdbook build
+
+

It will try to parse your SUMMARY.md file to understand the structure of your book +and fetch the corresponding files.

+

The rendered ouput will maintain the same directory structure as the source for +convenience. Large books will therefore remain structured when rendered.

+

Specify a directory

+

Like init, the build command can take a directory as argument to use instead of the +current working directory.

+
mdbook build path/to/book
+
+
+

note: make sure to run the build command in the root directory and not in the src directory

+ +
+ +
+ + + + + diff --git a/book-example/book/cli/cli-tool.html b/book-example/book/cli/cli-tool.html new file mode 100644 index 00000000..fa8c85b8 --- /dev/null +++ b/book-example/book/cli/cli-tool.html @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + +
+ + + +
+

Command Line Tool

+

mdBook can be used either as a command line tool or a Rust library. +Let's focus on the command line tool capabilities first.

+ +
+ +
+ + + + + diff --git a/book-example/book/cli/init.html b/book-example/book/cli/init.html new file mode 100644 index 00000000..bc5225a4 --- /dev/null +++ b/book-example/book/cli/init.html @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + +
+ + + +
+

The init command

+

The init command, used like this:

+
mdbook init
+
+

Will create a couple of files and directories in the working directory so that you can +spend more time writing your book and less setting it up.

+

The files set up for you are the following:

+
book-test/
+├── book
+└── src
+    ├── chapter_1.md
+    └── SUMMARY.md
+
+

The src directory is were you write your book in markdown. It contains all the source files, +configuration files, etc.

+

The book directory is where your book is rendered. All the output is ready to be uploaded +to a serer to be seen by the internet.

+

The SUMMARY.md file is the most important file, it's the skeleton of your book. +It's so important that it has it's own chapter.

+

Specify a directory

+

When using the init command, you can also specify a directory, instead of using the current directory, +by appending a path to the command:

+
mdbook init path/to/book
+
+

Not yet implemented

+

In the future I would like mdBook init to be able to:

+ + +
+ +
+ + + + + diff --git a/book-example/book/index.html b/book-example/book/index.html new file mode 100644 index 00000000..34e918e4 --- /dev/null +++ b/book-example/book/index.html @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + +
+ + + +
+

mdBook

+

mdBook is a command line tool and Rust library to create books using Markdown. +It's very similar to Gitbook but written in Rust.

+

This book serves as an example of the output of mdBook and as the docs at the same time.

+

mdBook is free and open source, you can find the source code on Github. +Issues and feature requests can be posted on the Github Issue tracker.

+

License

+

mdBook, all the code and this book, are released under the Mozilla Public License v2.0

+ +
+ +
+ + + + + diff --git a/book-example/src/README.md b/book-example/src/README.md new file mode 100644 index 00000000..1074e5e4 --- /dev/null +++ b/book-example/src/README.md @@ -0,0 +1,13 @@ +# mdBook + +**mdBook** is a command line tool and Rust library to create books using Markdown. +It's very similar to Gitbook but written in [Rust](http://www.rust-lang.org). + +This book serves as an example of the output of mdBook and as the docs at the same time. + +mdBook is free and open source, you can find the source code on [Github](https://github.com/azerupi/mdBook). +Issues and feature requests can be posted on the [Github Issue tracker](https://github.com/azerupi/mdBook/issues). + +## License + +mdBook, all the code and this book, are released under the [Mozilla Public License v2.0](https://www.mozilla.org/MPL/2.0/) diff --git a/book-example/src/SUMMARY.md b/book-example/src/SUMMARY.md new file mode 100644 index 00000000..dc62e27d --- /dev/null +++ b/book-example/src/SUMMARY.md @@ -0,0 +1,9 @@ +# Summary + +- [mdBook](README.md) +- [Command Line Tool](cli/cli-tool.md) + - [init](cli/init.md) + - [build](cli/build.md) +- [Format]() + - [SUMMARY.md]() +- [Rust Library]() diff --git a/book-example/src/cli/build.md b/book-example/src/cli/build.md new file mode 100644 index 00000000..011a4b2f --- /dev/null +++ b/book-example/src/cli/build.md @@ -0,0 +1,26 @@ +# The build command + +The build command is used to render your book: + +``` +mdbook build +``` + +It will try to parse your `SUMMARY.md` file to understand the structure of your book +and fetch the corresponding files. + +The rendered ouput will maintain the same directory structure as the source for +convenience. Large books will therefore remain structured when rendered. + +#### Specify a directory + +Like init, the build command can take a directory as argument to use instead of the +current working directory. + +``` +mdbook build path/to/book +``` + +------------------- + +**note:** make sure to run the build command in the root directory and not in the `src` directory diff --git a/book-example/src/cli/cli-tool.md b/book-example/src/cli/cli-tool.md new file mode 100644 index 00000000..592bab19 --- /dev/null +++ b/book-example/src/cli/cli-tool.md @@ -0,0 +1,4 @@ +# Command Line Tool + +mdBook can be used either as a command line tool or a Rust library. +Let's focus on the command line tool capabilities first. diff --git a/book-example/src/cli/init.md b/book-example/src/cli/init.md new file mode 100644 index 00000000..23d272ce --- /dev/null +++ b/book-example/src/cli/init.md @@ -0,0 +1,46 @@ +# The init command + +The init command, used like this: + +``` +mdbook init +``` + +Will create a couple of files and directories in the working directory so that you can +spend more time writing your book and less setting it up. + +The files set up for you are the following: +``` +book-test/ +├── book +└── src + ├── chapter_1.md + └── SUMMARY.md +``` + +The `src` directory is were you write your book in markdown. It contains all the source files, +configuration files, etc. + +The `book` directory is where your book is rendered. All the output is ready to be uploaded +to a serer to be seen by the internet. + +The `SUMMARY.md` file is the most important file, it's the skeleton of your book. +It's so important that it has it's own [chapter](). + +#### Specify a directory + +When using the init command, you can also specify a directory, instead of using the current directory, +by appending a path to the command: + +``` +mdbook init path/to/book +``` + +## Not yet implemented + +In the future I would like `mdBook init` to be able to: + +- Copy the default theme to the `src` directory in a `theme` directory when using a flag like `--theme`. +The user could then tweak the theme to his needs. +- Generate files that are in `SUMMARY.md`. If the user has already created a `SUMMARY.md` file and added some entries but did +not create the corresponding files, init command should create the files for him.