Create book from markdown files. Like Gitbook but implemented in Rust
Go to file
Steve Klabnik eed440ef5a fix mdbook test for the book 2015-12-29 17:59:08 -05:00
book-example fix mdbook test for the book 2015-12-29 17:59:08 -05:00
src Merge branch 'master' into watch-command 2015-12-29 13:40:13 +01:00
.gitignore Bumped version that was still set to 0.0.1 + added a bigger top margin for h2 and h3 elements 2015-11-10 16:26:39 +01:00
.travis.yml Converted all css to stylus 2015-09-18 22:13:55 +02:00
Cargo.toml Merge branch 'master' into watch-command 2015-12-29 13:40:13 +01:00
LICENSE Create LICENSE 2015-07-29 01:11:30 +02:00
README.md Bumped version to 0.0.4 (after publishing 0.0.3 to crates.io) + updated README to use cargo install for the installation 2015-12-11 22:17:05 +01:00
build.rs Only regenerate css when feature regenerate-css is enabled 2015-09-24 15:37:20 +02:00
deploy.sh Fix colors in deploy script + Fix link to API docs 2015-08-06 13:30:08 +02:00

README.md

mdBook Travis-CI Crates.io version License

Personal implementation of Gitbook in Rust

This project is still in it's early days. For more information about what is left on my to-do list, check the issue tracker

Example

To have an idea of what a rendered book looks like,take a look at the Documentation. It is rendered by the latest version of mdBook.

Installation

cargo install mdbook

If you want to regenerate the css (stylesheet), clone the git repo locally and make sure that you installed stylus and nib from npm because it is used to compile the stylesheets

Install node.js

npm install -g stylus nib

Then build with the regenerate-css feature:

cargo build --release --features="regenerate-css"

Structure

There are two main parts of this project:

  • The library: The crate is structured so that all the code that actually does something is part of the library. You could therefore easily hook mdbook into your existing project, extend it's functionality by wrapping it in some other code, etc.
  • The binary: Is just a wrapper around the library functionality providing a nice and easy command line interface.

Command line interface

init

If you run mdbook init in a directory, it will create a couple of folders and files you can start with. This is the strucutre it creates at the moment:

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

book and src are both directories. src contains the markdown files that will be used to render the ouput to the book directory.

Please, take a look at the Documentation for more information.

build

Use mdbook build in the directory to render the book. You can find more information in the Documentation

As a library

Aside from the command line interface, this crate can also be used as a library. This means that you could integrate it in an existing project, like a webapp for example. Since the command line interface is just a wrapper around the library functionality, when you use this crate as a library you have full access to all the functionality of the command line interface with and easy to use API and more!

See the Documentation and the API docs for more information.

Contributions

Contributions are highly apreciated. Here are some ideas:

  • Create new renderers, at the moment I have only created a renderer that uses handlebars, pulldown-cmark and renders to html. But you could create a renderer that uses another template engine, markdown parser or even outputs to another format like pdf.
  • Add tests I have not much experience in writing tests, all help to write meaningful tests is thus very welcome
  • write documentation documentation can always be improved
  • Smaller tasks I try to add a lot of the remaining tasks on the issue tracker with the label: Enhancement. Just pick one that looks interesting. The majority of the tasks are small enough to be tackled by people who are unfamiliar with the project.

If you have an idea for improvement, create a new issue. Or a pull request if you can :)

License

All the code is released under the Mozilla Public License v2.0, for more information take a look at the LICENSE file