Added an example book also containing the docs

This commit is contained in:
Mathieu David 2015-07-30 11:59:08 +02:00
parent 1111ff3ceb
commit 18c3ed4540
12 changed files with 511 additions and 0 deletions

View File

@ -0,0 +1,44 @@
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<meta name="description" content="{% block description %}{% endblock %}">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="book.css" media="screen" title="no title" charset="utf-8">
<link href='http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
</head>
<body>
<div id="sidebar" class="sidebar">
<ul class="chapter"><li><a href="README.html"><strong>1.</strong> mdBook</a></li><li><a href="cli/cli-tool.html"><strong>2.</strong> Command Line Tool</a></li><li><ul class="section"><li><a href="cli/init.html"><strong>2.1.</strong> init</a></li><li><a href="cli/build.html"><strong>2.2.</strong> build</a></li></ul><li><strong>3.</strong> Format</li><li><ul class="section"><li><strong>3.1.</strong> SUMMARY.md</li></ul><li><strong>4.</strong> Rust Library</li></ul>
</div>
<div id="page-wrapper" class="page-wrapper">
<div id="menu-bar" class="menu-bar">
<i id="sidebar-toggle" class="fa fa-bars left"></i>
<h1 class="menu-title"></h1>
</div>
<div id="page" class="page">
<h1>mdBook</h1>
<p><strong>mdBook</strong> is a command line tool and Rust library to create books using Markdown.
It's very similar to Gitbook but written in <a href="http://www.rust-lang.org">Rust</a>.</p>
<p>This book serves as an example of the output of mdBook and as the docs at the same time.</p>
<p>mdBook is free and open source, you can find the source code on <a href="https://github.com/azerupi/mdBook">Github</a>.
Issues and feature requests can be posted on the <a href="https://github.com/azerupi/mdBook/issues">Github Issue tracker</a>.</p>
<h2>License</h2>
<p>mdBook, all the code and this book, are released under the <a href="https://www.mozilla.org/MPL/2.0/">Mozilla Public License v2.0</a></p>
</div>
</div>
<script src="http://code.jquery.com/jquery-2.1.4.min.js"></script>
<script src="book.js"></script>
</body>
</html>

150
book-example/book/book.css Normal file
View File

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

17
book-example/book/book.js Normal file
View File

@ -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"});
}
});
});

View File

@ -0,0 +1,51 @@
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<meta name="description" content="{% block description %}{% endblock %}">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="../book.css" media="screen" title="no title" charset="utf-8">
<link href='http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
</head>
<body>
<div id="sidebar" class="sidebar">
<ul class="chapter"><li><a href="../README.html"><strong>1.</strong> mdBook</a></li><li><a href="../cli/cli-tool.html"><strong>2.</strong> Command Line Tool</a></li><li><ul class="section"><li><a href="../cli/init.html"><strong>2.1.</strong> init</a></li><li><a href="../cli/build.html"><strong>2.2.</strong> build</a></li></ul><li><strong>3.</strong> Format</li><li><ul class="section"><li><strong>3.1.</strong> SUMMARY.md</li></ul><li><strong>4.</strong> Rust Library</li></ul>
</div>
<div id="page-wrapper" class="page-wrapper">
<div id="menu-bar" class="menu-bar">
<i id="sidebar-toggle" class="fa fa-bars left"></i>
<h1 class="menu-title"></h1>
</div>
<div id="page" class="page">
<h1>The build command</h1>
<p>The build command is used to render your book:</p>
<pre><code>mdbook build
</code></pre>
<p>It will try to parse your <code>SUMMARY.md</code> file to understand the structure of your book
and fetch the corresponding files.</p>
<p>The rendered ouput will maintain the same directory structure as the source for
convenience. Large books will therefore remain structured when rendered.</p>
<h4>Specify a directory</h4>
<p>Like init, the build command can take a directory as argument to use instead of the
current working directory.</p>
<pre><code>mdbook build path/to/book
</code></pre>
<hr />
<p><strong>note:</strong> make sure to run the build command in the root directory and not in the <code>src</code> directory</p>
</div>
</div>
<script src="http://code.jquery.com/jquery-2.1.4.min.js"></script>
<script src="../book.js"></script>
</body>
</html>

View File

@ -0,0 +1,39 @@
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<meta name="description" content="{% block description %}{% endblock %}">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="../book.css" media="screen" title="no title" charset="utf-8">
<link href='http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
</head>
<body>
<div id="sidebar" class="sidebar">
<ul class="chapter"><li><a href="../README.html"><strong>1.</strong> mdBook</a></li><li><a href="../cli/cli-tool.html"><strong>2.</strong> Command Line Tool</a></li><li><ul class="section"><li><a href="../cli/init.html"><strong>2.1.</strong> init</a></li><li><a href="../cli/build.html"><strong>2.2.</strong> build</a></li></ul><li><strong>3.</strong> Format</li><li><ul class="section"><li><strong>3.1.</strong> SUMMARY.md</li></ul><li><strong>4.</strong> Rust Library</li></ul>
</div>
<div id="page-wrapper" class="page-wrapper">
<div id="menu-bar" class="menu-bar">
<i id="sidebar-toggle" class="fa fa-bars left"></i>
<h1 class="menu-title"></h1>
</div>
<div id="page" class="page">
<h1>Command Line Tool</h1>
<p>mdBook can be used either as a command line tool or a Rust library.
Let's focus on the command line tool capabilities first.</p>
</div>
</div>
<script src="http://code.jquery.com/jquery-2.1.4.min.js"></script>
<script src="../book.js"></script>
</body>
</html>

View File

@ -0,0 +1,68 @@
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<meta name="description" content="{% block description %}{% endblock %}">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="../book.css" media="screen" title="no title" charset="utf-8">
<link href='http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
</head>
<body>
<div id="sidebar" class="sidebar">
<ul class="chapter"><li><a href="../README.html"><strong>1.</strong> mdBook</a></li><li><a href="../cli/cli-tool.html"><strong>2.</strong> Command Line Tool</a></li><li><ul class="section"><li><a href="../cli/init.html"><strong>2.1.</strong> init</a></li><li><a href="../cli/build.html"><strong>2.2.</strong> build</a></li></ul><li><strong>3.</strong> Format</li><li><ul class="section"><li><strong>3.1.</strong> SUMMARY.md</li></ul><li><strong>4.</strong> Rust Library</li></ul>
</div>
<div id="page-wrapper" class="page-wrapper">
<div id="menu-bar" class="menu-bar">
<i id="sidebar-toggle" class="fa fa-bars left"></i>
<h1 class="menu-title"></h1>
</div>
<div id="page" class="page">
<h1>The init command</h1>
<p>The init command, used like this:</p>
<pre><code>mdbook init
</code></pre>
<p>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.</p>
<p>The files set up for you are the following:</p>
<pre><code>book-test/
├── book
└── src
├── chapter_1.md
└── SUMMARY.md
</code></pre>
<p>The <code>src</code> directory is were you write your book in markdown. It contains all the source files,
configuration files, etc.</p>
<p>The <code>book</code> directory is where your book is rendered. All the output is ready to be uploaded
to a serer to be seen by the internet.</p>
<p>The <code>SUMMARY.md</code> file is the most important file, it's the skeleton of your book.
It's so important that it has it's own <a href="">chapter</a>.</p>
<h4>Specify a directory</h4>
<p>When using the init command, you can also specify a directory, instead of using the current directory,
by appending a path to the command:</p>
<pre><code>mdbook init path/to/book
</code></pre>
<h2>Not yet implemented</h2>
<p>In the future I would like <code>mdBook init</code> to be able to:</p>
<ul>
<li>Copy the default theme to the <code>src</code> directory in a <code>theme</code> directory when using a flag like <code>--theme</code>.
The user could then tweak the theme to his needs.</li>
<li>Generate files that are in <code>SUMMARY.md</code>. If the user has already created a <code>SUMMARY.md</code> file and added some entries but did
not create the corresponding files, init command should create the files for him.</li>
</ul>
</div>
</div>
<script src="http://code.jquery.com/jquery-2.1.4.min.js"></script>
<script src="../book.js"></script>
</body>
</html>

View File

@ -0,0 +1,44 @@
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<meta name="description" content="{% block description %}{% endblock %}">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="book.css" media="screen" title="no title" charset="utf-8">
<link href='http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
</head>
<body>
<div id="sidebar" class="sidebar">
<ul class="chapter"><li><a href="README.html"><strong>1.</strong> mdBook</a></li><li><a href="cli/cli-tool.html"><strong>2.</strong> Command Line Tool</a></li><li><ul class="section"><li><a href="cli/init.html"><strong>2.1.</strong> init</a></li><li><a href="cli/build.html"><strong>2.2.</strong> build</a></li></ul><li><strong>3.</strong> Format</li><li><ul class="section"><li><strong>3.1.</strong> SUMMARY.md</li></ul><li><strong>4.</strong> Rust Library</li></ul>
</div>
<div id="page-wrapper" class="page-wrapper">
<div id="menu-bar" class="menu-bar">
<i id="sidebar-toggle" class="fa fa-bars left"></i>
<h1 class="menu-title"></h1>
</div>
<div id="page" class="page">
<h1>mdBook</h1>
<p><strong>mdBook</strong> is a command line tool and Rust library to create books using Markdown.
It's very similar to Gitbook but written in <a href="http://www.rust-lang.org">Rust</a>.</p>
<p>This book serves as an example of the output of mdBook and as the docs at the same time.</p>
<p>mdBook is free and open source, you can find the source code on <a href="https://github.com/azerupi/mdBook">Github</a>.
Issues and feature requests can be posted on the <a href="https://github.com/azerupi/mdBook/issues">Github Issue tracker</a>.</p>
<h2>License</h2>
<p>mdBook, all the code and this book, are released under the <a href="https://www.mozilla.org/MPL/2.0/">Mozilla Public License v2.0</a></p>
</div>
</div>
<script src="http://code.jquery.com/jquery-2.1.4.min.js"></script>
<script src="book.js"></script>
</body>
</html>

View File

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

View File

@ -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]()

View File

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

View File

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

View File

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