Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thlorenz/gitbookify
Generates gitbook chapters and sections from a given markdown file.
https://github.com/thlorenz/gitbookify
Last synced: 15 days ago
JSON representation
Generates gitbook chapters and sections from a given markdown file.
- Host: GitHub
- URL: https://github.com/thlorenz/gitbookify
- Owner: thlorenz
- License: mit
- Created: 2014-09-24T15:20:41.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2014-11-14T17:48:45.000Z (almost 10 years ago)
- Last Synced: 2024-10-18T00:41:20.056Z (20 days ago)
- Language: JavaScript
- Homepage: https://github.com/thlorenz/gitbookify
- Size: 168 KB
- Stars: 10
- Watchers: 4
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gitbookify [![build status](https://secure.travis-ci.org/thlorenz/gitbookify.png)](http://travis-ci.org/thlorenz/gitbookify)
Generates gitbook chapters and sections from a given markdown file.
## Installation
npm install -g gitbookify
## Usage
```
gitbookify --outdirGenerates gitbook chapters and sections from a given markdown file.
OPTIONS:
-o, --outdir the directory to which to write the generated files used to generate a gitbook
-l, --loglevel level at which to log: silly|verbose|info|warn|error|silent -- default: info
-h, --help Print this help message.EXAMPLES:
Generate with default options and launch gitbook server afterwards:
gitbookify README.md --outdir ./my-gitbook && gitbook serve ./my-gitbookOverride loglevel:
gitbookify API.md --loglevel silly -o ./my-gitbook
```Sections are created by separating on each `# ` header. If headers have the same name they go into the same chapter. For
more info [review this example](https://raw.githubusercontent.com/thlorenz/gitbookify/master/test/fixtures/addon-slides.md).After generating the chapters you can use [gitbook](https://github.com/GitbookIO/gitbook) to either serve them `gitbook
serve ./my-gitbook` or [do all the other gitbook things](https://github.com/GitbookIO/gitbook#how-to-use-it).## Speaker Notes
Simply enclose your speaker notes in a `notes` comment as shown below. The notes will be printed to the browser console
when you open the particular page in the gitbook.```html
```
## Images
There are two ways to add images to your gitbook.
### Linking Remote URLS
That is easy since they take absolute paths like `https://path.to/img.png` and work at all times.
**Disadvantage**: You have to be online when presenting/reading the book and as we all know good network is not a given
at conferences### Linking to Local Directory
You can also link to a directory relative to the markdown file you create, i.e. `img/my-image.png`.
The problem is that the resulting pages of the book are placed somewhere else and cannot find that `img` directory. In
order to fix that use this simple function in order to create softlinks from each book page to the main `img` directory.```sh
link_img() {
for D in *; do
if [ -d "${D}" ]; then
ln -s ../../img $D/img
fi
done
}
```You can then use it in your script that builds the book:
```sh
rm -rf ./gitbook
gitbookify slides.md -o gitbook && \
rm -rf ./book && \
gitbook build ./gitbook -o ./book && \
cd ./book && \
link_img
```[here is a full example](https://github.com/thlorenz/talks/blob/e27198bc7ded08bb9513b47d510c8f01db51ce90/memory-profiling/build.sh) of such script.
## License
MIT