massages latex a bit, removed extraneous headings from book source

master
Kenton Hamaluik 5 years ago
parent 6f0139d97b
commit fc0a672b74

@ -1,17 +1,7 @@
---
title = "Introduction"
title = "Command-line Interface"
---
# Introduction
_mkbook_ is my simpler alternative to [_mdbook_](https://crates.io/crates/mdbook) which is a great tool, but for which I really dislike some of the decisions they took, such as relying on javascript for highlighting and navigation, and including a lot of bells and whistles such as javascript-based search.
This tool aims to work somewhat similarly to _mdbook_, but is generally intended to be a more minimal alternative that is customized more towards my needs and desires than anything else.
If you're not familiar with _mdbook_, _mkbook_ is a tool to convert a collection of [Markdown](https://commonmark.org/) files into a static website / book which can be published online. It was created to help me write documentation with minimum fuss while presenting it in an easy-to-consume manner.
## Command-line Interface
_mkbook_ may be installed using _Cargo_ (`cargo install --force --path .` in the _mkbook_ repo directory), and after that it presents a command-line interface:
```sh
@ -38,7 +28,7 @@ SUBCOMMANDS:
watch build the book and continually rebuild whenever the source changes
```
### The Init Command
# The Init Command
The init command is a tool to help you get started, and will create an initial `README.md` file and a stub of your first chapter.
@ -58,7 +48,7 @@ OPTIONS:
-d, --directory <directory> an optional directory to initialize into [default: src]
```
### The Build Command
# The Build Command
The build command is the primary command for _mkbook_, and is responsible for taking the `.md` files and building the resulting website.
@ -79,7 +69,7 @@ OPTIONS:
-o, --out <out> an optional directory to render the contents into [default: book]
```
### The Watch Command
# The Watch Command
The watch command is basically the same as the `build` command, however after building it continues to monitor the source directory and if _any_ changes are made (a file is saved, renamed, removed, created, etc), the entire book is re-built. In the future, this will hopefully be smarter but for now it just the whole thing at once. Stop watching using <kbd>Ctrl+C</kbd> or sending `SIGINT`.
@ -99,3 +89,28 @@ OPTIONS:
-i, --in <in> an optional directory to take the book sources from [default: src]
-o, --out <out> an optional directory to render the contents into [default: book]
```
# Sample Usages
Build the [GitHub Pages](https://pages.github.com/) document (this book):
```sh
mkbook build -i docs-src -o docs
```
Build the book, continually watching for changes and enabling auto-reloading in the browser so you can see the book update as you write:
```sh
mkbook watch -i docs-src -o docs --reload
```
Build a [LaTeX](https://www.latex-project.org/) version of the book, then compile it to a [PDF](https://en.wikipedia.org/wiki/PDF) and open it in [evince](https://wiki.gnome.org/Apps/Evince):
```sh
mkdir build
mkbook build -i docs-src -o docs --latex build/book.tex
cd build
xelatex -shell-escape book.tex
xelatex -shell-escape book.tex
evince book.pdf
```

@ -2,8 +2,6 @@
title = "CommonMark"
---
# CommonMark
_mkbook_ nominally utilizes [CommonMark](https://commonmark.org/) with some [GFM](https://github.github.com/gfm/) extensions through the use of the [comrak](https://crates.io/crates/comrak) crate. In using _comrak_, a specific set of options are used, which are listed here:
```rust
@ -33,7 +31,6 @@ Mostly, know that the following extensions are enabled:
* [Autolinks](https://github.github.com/gfm/#autolinks-extension-)
* [Task Lists](https://github.github.com/gfm/#task-list-items-extension-)
* Superscripts (`e = mc^2^.` → `e = mc<sup>2</sup>.`)
* [Footnotes](https://kramdown.gettalong.org/syntax.html#footnotes)
* Description Lists:
```md
First term

@ -2,8 +2,6 @@
title = "Syntax Highlighting"
---
# Syntax Highlighting
GFM syntax highlighting is also available by using fenced code tags with a label denoting the language, as such:
~~~
@ -164,7 +162,7 @@ Hxml
JSON
: `json`, `sublime-settings`, `sublime-menu`, `sublime-keymap`, `sublime-mousemap`, `sublime-theme`, `sublime-build`, `sublime-project`, `sublime-completions`, `sublime-commands`, `sublime-macro`, `sublime-color-scheme`
: `json`
Java

@ -2,8 +2,6 @@
title = "PlantUML Diagrams"
---
# PlantUML Diagrams
If you have [PlantUML](http://plantuml.com/) installed and available on your path, _mkbook_ will try to render any code blocks with a language tag of `plantuml` as inline SVG images.
For example:

@ -2,8 +2,6 @@
title = "KaTeX (Math) Formulas"
---
# KaTeX (Math) Formulas
If you have [KaTeX](https://github.com/KaTeX/KaTeX) installed and available on your path, _mkbook_ will try to render any code blocks with a language tag of `katex` as inline math blocks.
For example:

@ -2,8 +2,6 @@
title = "Images"
---
# Images
To include an image, use the standard markdown format:
```md

@ -2,18 +2,17 @@
title = "Markdown"
---
# Markdown
_mkbook_ relies pretty extensively on [Markdown](https://daringfireball.net/projects/markdown/) for its ease of use. If you're not familiar with _Markdown_, it is a simple markup language that is design to be easy to read and write in plain text, and then (relatively) easy for a computer to convert into other formats such as HTML or LaTeX.
The above paragraph looks like this:
```md
_mkbook_ relies pretty extensively on
[Markdown](https://daringfireball.net/projects/markdown/) for its ease of use.
If you're not familiar with _Markdown_, it is a simple markup language that is
design to be easy to read and write in plain text, and then (relatively) easy
for a computer to convert into other formats such as HTML or LaTeX.
[Markdown](https://daringfireball.net/projects/markdown/) for
its ease of use. If you're not familiar with _Markdown_, it is
a simple markup language that is designed to be easy to read
and write in plain text, and then (relatively) easy for a
computer to convert into other formats such as HTML or LaTeX.
```
_Markdown_ by itself isn't quite enough for most purposes, so _mkbook_ actually uses the _CommonMark_ spec with some additional extensions to make life easier.

@ -2,8 +2,6 @@
title = "Front Matter"
---
# Front Matter
Each `.md` file can optionally contain a header with metadata describing the document. If the header isn't present, or if any keys are missing, default values will be used.
To insert a header into a `.md` file, insert three dashes (`---`), followed by a new-line, followed by the front matter contents, followed by a newline, then another three dashes and a new-line. The metadata is in the [TOML](https://github.com/toml-lang/toml) format, so for example the front-matter (and first line) for a file could look like this:
@ -15,12 +13,10 @@ author = "Kenton Hamaluik"
pubdate = 2019-11-29T15:22:00-07:00
---
# Front Matter
Each `.md` file can optionally contain a header with metadata describing the document. If the header isn't present, or if any keys are missing, default values will be used.
```
## Supported Keys
# Supported Keys
The list of supported keys is subject to change, but for now it is as follows:

@ -2,11 +2,9 @@
title = "Structure"
---
# Structure
_mkbook_ follows a fairly simple directory structure for now, with a `README.md` file declaring the book's metadata, and `.md` files defining each chapter of the book.
## `README.md`
# README.md
_mkbook_ generally requires a `README.md` file to reside in your source directory. This file is responsible for defining the metadata associated with your book:
@ -18,7 +16,7 @@ _mkbook_ generally requires a `README.md` file to reside in your source director
If the `README.md` file or any of the entries are missing, default values will be used. The `README.md` file should be formatted as any other page, with the `title`, `author`, `pubdate`, and `url` specified in the frontmatter, and the book description the _Markdown_ contents of the `README.md` file.
### Sample
## Sample
```md
---
@ -37,7 +35,7 @@ to be a more minimal alternative that is customized more towards my needs and
desires than anything else.
```
### Default Values
## Default Values
`title`
@ -59,7 +57,7 @@ desires than anything else.
: ""
## Assets
# Assets
Any files in the `src` directory which are not included in `.gitignore` and do not end in the extension `.md` will be copied to the output folder. You can use this to include images, files, etc, for example the following image is an asset bundled with the book:
@ -70,7 +68,7 @@ Any files in the `src` directory which are not included in `.gitignore` and do n
![chapter-six](../book-chapter-six-5834.jpg "Photo by Kaboompics.com from Pexels")
## Documents
# Documents
_mkbook_ works on mostly a flat directory structure, however one level of sub-directories are supported in order to create sections within chapters. Files that don't end in a `.md` extension are completely ignored. Each `.md` file in the root source directly is it's own chapter. To create chapters with sub-sections, create a sub-directory in the root directory and then create a `README.md` file, which will become the root of the chapter, with all `.md` files in the sub-directory becoming sections in the chapter. The `title` in the `README.md` file's frontmatter will be used as the name of the chapter.

@ -2,6 +2,4 @@
title = "Customization"
---
# Customization
There isn't any way to customize the templates nor the CSS yet, though I will investigate this if the need arises. This is because both the templates and CSS are currently compiled at compile-time instead of run-time.

@ -2,33 +2,31 @@
title = "How it Works"
---
# How it Works
_mkbook_ generates a completely static, javascript-free website from a series of Markdown files. All of the layout and styling is controlled purely by hand-crafted CSS specific to this book's purpose.
## Assets
# Assets
_mkbook_ currently bundles two assets which get written into the book directory: `favicon.ico`, and `icons.svg`. `favicon.ico` is the [Font Awesome 5 book icon](https://fontawesome.com/icons/book?style=solid), and `icons.svg` contains 3 [Font Awesome 5](https://fontawesome.com/) arrow icons: [arrow-left](https://fontawesome.com/icons/arrow-left?style=solid), [arrow-right](https://fontawesome.com/icons/arrow-right?style=solid), and [arrow-up](https://fontawesome.com/icons/arrow-up?style=solid) which are used for navigation. These files are compiled into the _mkbook_ binary using the [`include_bytes!` macro](https://doc.rust-lang.org/std/macro.include_bytes.html), and written to the output folder on each build.
## Styling
# Styling
_mkbook_ utilizes [Sass](https://sass-lang.com/) to define it's styles; you can view the sources [on github](https://github.com/hamaluik/mkbook/tree/master/style). In _mkbook_'s build script, the styles are compiled from their native `.scss` format into a single, compressed `.css` file using [sass-rs](https://crates.io/crates/sass-rs). The resulting `.css` file is then bundled into the binary using the [`include_str!` macro](https://doc.rust-lang.org/std/macro.include_str.html). When a book is generated, this `.css` is written to the output folder as `style.css`, where it is included by each generated `.html` file.
## Templates
# Templates
_mkbook_ contains two template files: one for the index, and one for each page / chapter, and uses [Askama](https://crates.io/crates/askama) to render the templates. Since the _Askama_ templates are compiled when _mkbook_ is compiled, it is not currently possible to change the templates at run time. You can view the sources for these templates [on github](https://github.com/hamaluik/mkbook/tree/master/templates).
## Markdown Formatting
# Markdown Formatting
Markdown is formatted usiing [comrak](https://crates.io/crates/comrak) with some specific options, see the [Markdown chapter](02-markdown.html) for more information.
## Syntax Highlighting
# Syntax Highlighting
Code is syntax-highlighted using [syntect](https://crates.io/crates/syntect) with the default langauges and the `base16-eighties` colour scheme. Some additional languages above the base list supported by _syntect_ have been aded:
* `haxe`
* `hxml`
* `sass`
* `scss`
* `toml`
* [`haxe`](https://haxe.org/)
* [`hxml`](https://haxe.org/manual/compiler-usage-hxml.html)
* [`sass`](https://sass-lang.com/documentation/syntax#the-indented-syntax)
* [`scss`](https://sass-lang.com/documentation/syntax)
* [`toml`](https://github.com/toml-lang/toml)

@ -4,6 +4,8 @@ author = "Kenton Hamaluik"
url = "https://hamaluik.github.io/mkbook/"
---
_mkbook_ is my simpler alternative to [mdbook](https://crates.io/crates/mdbook) which is a great tool, but for which I really dislike some of the decisions they took, such as relying on javascript for highlighting and navigation, and including a lot of bells and whistles such as javascript-based search.
_mkbook_ is my simpler alternative to [_mdbook_](https://crates.io/crates/mdbook) which is a great tool, however I really dislike some of the decisions they took—such as relying on javascript for highlighting and navigation and including a lot of bells and whistles such as javascript-based search.
This tool aims to work somewhat similarly to _mdbook_, but is generally intended to be a more minimal alternative that is customized more towards my needs and desires than anything else.
If you're not familiar with _mdbook_, _mkbook_ is a tool to convert a collection of [Markdown](https://commonmark.org/) files into a static website / book which can be published online. It was created to help me write documentation with minimum fuss while presenting it in an easy-to-consume manner.

@ -0,0 +1,219 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>The mkbook Book | Command-line Interface</title>
<link rel="stylesheet" href="../style.css" type="text/css" media="all" />
<link rel="shortcut icon" href="../favicon.ico" />
<meta property="og:title" content="The mkbook Book" />
<meta property="og:site_name" content="The mkbook Book" />
<meta property="og:type" content="book" />
<meta property="og:url" content="https://hamaluik.github.io/mkbook//01-command-line/index.html" />
<meta property="book:author" content="Kenton Hamaluik" />
<meta property="book:release_date" content="2019-12-08T18:56:12.588609853+00:00" />
</head>
<body>
<nav class="big">
<header>
<h1><a href="../index.html">The mkbook Book</a></h1>
<h2>by Kenton Hamaluik</h2>
</header>
<ol>
<li>
<a href="../01-command-line/index.html" class = "current">Command-line Interface</a>
</li>
<li>
<a href="../02-markdown/index.html">Markdown</a>
<ol>
<li><a href="../02-markdown/01-commonmark.html">CommonMark</a></li>
<li><a href="../02-markdown/02-syntax-highlighting.html">Syntax Highlighting</a></li>
<li><a href="../02-markdown/03-plantuml-diagrams.html">PlantUML Diagrams</a></li>
<li><a href="../02-markdown/04-katex-formulas.html">KaTeX (Math) Formulas</a></li>
<li><a href="../02-markdown/05-images.html">Images</a></li>
<li><a href="../02-markdown/06-tables.html">Tables</a></li>
<li><a href="../02-markdown/07-task-lists.html">Task Lists</a></li>
</ol>
</li>
<li>
<a href="../03-frontmatter/index.html">Front Matter</a>
</li>
<li>
<a href="../04-structure/index.html">Structure</a>
</li>
<li>
<a href="../05-customization/index.html">Customization</a>
</li>
<li>
<a href="../06-how-it-works/index.html">How it Works</a>
</li>
</ol>
</nav>
<nav class="small">
<span>
<a href="../index.html" alt="Table of Contents">
<span class="icon">
<svg class="icon-list-ol">
<use xlink:href="../icons.svg#icon-list-ol">
</svg>
</span>
</a>
<span class="placeholder"></span>
</span>
<span class="title">Command-line Interface</span>
<span>
<span class="placeholder"></span>
<a href="../02-markdown&#x2f;index.html" alt="Markdown">
<span class="icon">
<svg class="icon-arrow-right">
<use xlink:href="../icons.svg#icon-arrow-right">
</svg>
</span>
</a>
</span>
</nav>
<article>
<p><em>mkbook</em> may be installed using <em>Cargo</em> (<code>cargo install --force --path .</code> in the <em>mkbook</em> repo directory), and after that it presents a command-line interface:</p>
<pre style="background-color:#2d2d2d;">
<span style="color:#6699cc;">$</span><span style="color:#d3d0c8;"> mkbook
</span><span style="color:#6699cc;">mkbook</span><span style="color:#d3d0c8;"> 0.3.0
</span><span style="color:#6699cc;">Kenton</span><span style="color:#d3d0c8;"> Hamaluik &lt;kenton@hamaluik.ca&gt;
</span><span style="color:#d3d0c8;">
</span><span style="color:#d3d0c8;">
</span><span style="color:#6699cc;">USAGE:
</span><span style="color:#d3d0c8;"> </span><span style="color:#6699cc;">mkbook </span><span style="color:#cc99cc;">[</span><span style="color:#d3d0c8;">SUBCOMMAND</span><span style="color:#cc99cc;">]
</span><span style="color:#d3d0c8;">
</span><span style="color:#6699cc;">FLAGS:
</span><span style="color:#d3d0c8;"> </span><span style="color:#6699cc;">-h,</span><span style="color:#f2777a;"> --help
</span><span style="color:#d3d0c8;"> </span><span style="color:#6699cc;">Prints</span><span style="color:#d3d0c8;"> help information
</span><span style="color:#d3d0c8;">
</span><span style="color:#d3d0c8;"> </span><span style="color:#6699cc;">-V,</span><span style="color:#f2777a;"> --version
</span><span style="color:#d3d0c8;"> </span><span style="color:#6699cc;">Prints</span><span style="color:#d3d0c8;"> version information
</span><span style="color:#d3d0c8;">
</span><span style="color:#d3d0c8;">
</span><span style="color:#6699cc;">SUBCOMMANDS:
</span><span style="color:#d3d0c8;"> </span><span style="color:#6699cc;">build</span><span style="color:#d3d0c8;"> build the book
</span><span style="color:#d3d0c8;"> </span><span style="color:#66cccc;">help</span><span style="color:#d3d0c8;"> Prints this message or the help of the given subcommand(s)
</span><span style="color:#d3d0c8;"> </span><span style="color:#6699cc;">init</span><span style="color:#d3d0c8;"> initialize a mkbook directory tree
</span><span style="color:#d3d0c8;"> </span><span style="color:#6699cc;">watch</span><span style="color:#d3d0c8;"> build the book and continually rebuild whenever the source changes
</span></pre>
<h1><a href="#the-init-command" aria-hidden="true" class="anchor" id="headerthe-init-command"></a>The Init Command</h1>
<p>The init command is a tool to help you get started, and will create an initial <code>README.md</code> file and a stub of your first chapter.</p>
<pre style="background-color:#2d2d2d;">
<span style="color:#6699cc;">$</span><span style="color:#d3d0c8;"> mkbook init</span><span style="color:#f2777a;"> --help
</span><span style="color:#6699cc;">mkbook-init
</span><span style="color:#6699cc;">initialize</span><span style="color:#d3d0c8;"> a mkbook directory tree
</span><span style="color:#d3d0c8;">
</span><span style="color:#6699cc;">USAGE:
</span><span style="color:#d3d0c8;"> </span><span style="color:#6699cc;">mkbook</span><span style="color:#d3d0c8;"> init </span><span style="color:#cc99cc;">[</span><span style="color:#d3d0c8;">OPTIONS</span><span style="color:#cc99cc;">]
</span><span style="color:#d3d0c8;">
</span><span style="color:#6699cc;">FLAGS:
</span><span style="color:#d3d0c8;"> </span><span style="color:#6699cc;">-h,</span><span style="color:#f2777a;"> --help</span><span style="color:#d3d0c8;"> Prints help information
</span><span style="color:#d3d0c8;"> </span><span style="color:#6699cc;">-V,</span><span style="color:#f2777a;"> --version</span><span style="color:#d3d0c8;"> Prints version information
</span><span style="color:#d3d0c8;">
</span><span style="color:#6699cc;">OPTIONS:
</span><span style="color:#d3d0c8;"> </span><span style="color:#6699cc;">-d,</span><span style="color:#f2777a;"> --directory </span><span style="color:#d3d0c8;">&lt;directory&gt; an optional directory to initialize into </span><span style="color:#cc99cc;">[</span><span style="color:#d3d0c8;">default: src</span><span style="color:#cc99cc;">]
</span></pre>
<h1><a href="#the-build-command" aria-hidden="true" class="anchor" id="headerthe-build-command"></a>The Build Command</h1>
<p>The build command is the primary command for <em>mkbook</em>, and is responsible for taking the <code>.md</code> files and building the resulting website.</p>
<pre style="background-color:#2d2d2d;">
<span style="color:#6699cc;">$</span><span style="color:#d3d0c8;"> mkbook build</span><span style="color:#f2777a;"> --help
</span><span style="color:#6699cc;">mkbook-build
</span><span style="color:#6699cc;">build</span><span style="color:#d3d0c8;"> the book
</span><span style="color:#d3d0c8;">
</span><span style="color:#6699cc;">USAGE:
</span><span style="color:#d3d0c8;"> </span><span style="color:#6699cc;">mkbook</span><span style="color:#d3d0c8;"> build </span><span style="color:#cc99cc;">[</span><span style="color:#d3d0c8;">OPTIONS</span><span style="color:#cc99cc;">]
</span><span style="color:#d3d0c8;">
</span><span style="color:#6699cc;">FLAGS:
</span><span style="color:#d3d0c8;"> </span><span style="color:#6699cc;">-h,</span><span style="color:#f2777a;"> --help</span><span style="color:#d3d0c8;"> Prints help information
</span><span style="color:#d3d0c8;"> </span><span style="color:#6699cc;">-V,</span><span style="color:#f2777a;"> --version</span><span style="color:#d3d0c8;"> Prints version information
</span><span style="color:#d3d0c8;">
</span><span style="color:#6699cc;">OPTIONS:
</span><span style="color:#d3d0c8;"> </span><span style="color:#6699cc;">-i,</span><span style="color:#f2777a;"> --in </span><span style="color:#d3d0c8;">&lt;in&gt; an optional directory to take the book sources from </span><span style="color:#cc99cc;">[</span><span style="color:#d3d0c8;">default: src</span><span style="color:#cc99cc;">]
</span><span style="color:#d3d0c8;"> </span><span style="color:#6699cc;">-o,</span><span style="color:#f2777a;"> --out </span><span style="color:#d3d0c8;">&lt;out&gt; an optional directory to render the contents into </span><span style="color:#cc99cc;">[</span><span style="color:#d3d0c8;">default: book</span><span style="color:#cc99cc;">]
</span></pre>
<h1><a href="#the-watch-command" aria-hidden="true" class="anchor" id="headerthe-watch-command"></a>The Watch Command</h1>
<p>The watch command is basically the same as the <code>build</code> command, however after building it continues to monitor the source directory and if <em>any</em> changes are made (a file is saved, renamed, removed, created, etc), the entire book is re-built. In the future, this will hopefully be smarter but for now it just the whole thing at once. Stop watching using <kbd>Ctrl+C</kbd> or sending <code>SIGINT</code>.</p>
<pre style="background-color:#2d2d2d;">
<span style="color:#6699cc;">$</span><span style="color:#d3d0c8;"> mkbook build</span><span style="color:#f2777a;"> --help
</span><span style="color:#6699cc;">mkbook-watch
</span><span style="color:#6699cc;">build</span><span style="color:#d3d0c8;"> the book and continually rebuild whenever the source changes
</span><span style="color:#d3d0c8;">
</span><span style="color:#6699cc;">USAGE:
</span><span style="color:#d3d0c8;"> </span><span style="color:#6699cc;">mkbook</span><span style="color:#d3d0c8;"> watch </span><span style="color:#cc99cc;">[</span><span style="color:#d3d0c8;">OPTIONS</span><span style="color:#cc99cc;">]
</span><span style="color:#d3d0c8;">
</span><span style="color:#6699cc;">FLAGS:
</span><span style="color:#d3d0c8;"> </span><span style="color:#6699cc;">-h,</span><span style="color:#f2777a;"> --help</span><span style="color:#d3d0c8;"> Prints help information
</span><span style="color:#d3d0c8;"> </span><span style="color:#6699cc;">-V,</span><span style="color:#f2777a;"> --version</span><span style="color:#d3d0c8;"> Prints version information
</span><span style="color:#d3d0c8;">
</span><span style="color:#6699cc;">OPTIONS:
</span><span style="color:#d3d0c8;"> </span><span style="color:#6699cc;">-i,</span><span style="color:#f2777a;"> --in </span><span style="color:#d3d0c8;">&lt;in&gt; an optional directory to take the book sources from </span><span style="color:#cc99cc;">[</span><span style="color:#d3d0c8;">default: src</span><span style="color:#cc99cc;">]
</span><span style="color:#d3d0c8;"> </span><span style="color:#6699cc;">-o,</span><span style="color:#f2777a;"> --out </span><span style="color:#d3d0c8;">&lt;out&gt; an optional directory to render the contents into </span><span style="color:#cc99cc;">[</span><span style="color:#d3d0c8;">default: book</span><span style="color:#cc99cc;">]
</span></pre>
<h1><a href="#sample-usages" aria-hidden="true" class="anchor" id="headersample-usages"></a>Sample Usages</h1>
<p>Build the <a href="https://pages.github.com/">GitHub Pages</a> document (this book):</p>
<pre style="background-color:#2d2d2d;">
<span style="color:#6699cc;">mkbook</span><span style="color:#d3d0c8;"> build</span><span style="color:#f2777a;"> -i</span><span style="color:#d3d0c8;"> docs-src</span><span style="color:#f2777a;"> -o</span><span style="color:#d3d0c8;"> docs
</span></pre>
<p>Build the book, continually watching for changes and enabling auto-reloading in the browser so you can see the book update as you write:</p>
<pre style="background-color:#2d2d2d;">
<span style="color:#6699cc;">mkbook</span><span style="color:#d3d0c8;"> watch</span><span style="color:#f2777a;"> -i</span><span style="color:#d3d0c8;"> docs-src</span><span style="color:#f2777a;"> -o</span><span style="color:#d3d0c8;"> docs</span><span style="color:#f2777a;"> --reload
</span></pre>
<p>Build a <a href="https://www.latex-project.org/">LaTeX</a> version of the book, then compile it to a <a href="https://en.wikipedia.org/wiki/PDF">PDF</a> and open it in <a href="https://wiki.gnome.org/Apps/Evince">evince</a>:</p>
<pre style="background-color:#2d2d2d;">
<span style="color:#6699cc;">mkdir</span><span style="color:#d3d0c8;"> build
</span><span style="color:#6699cc;">mkbook</span><span style="color:#d3d0c8;"> build</span><span style="color:#f2777a;"> -i</span><span style="color:#d3d0c8;"> docs-src</span><span style="color:#f2777a;"> -o</span><span style="color:#d3d0c8;"> docs</span><span style="color:#f2777a;"> --latex</span><span style="color:#d3d0c8;"> build/book.tex
</span><span style="color:#66cccc;">cd</span><span style="color:#d3d0c8;"> build
</span><span style="color:#6699cc;">xelatex</span><span style="color:#f2777a;"> -shell-escape</span><span style="color:#d3d0c8;"> book.tex
</span><span style="color:#6699cc;">xelatex</span><span style="color:#f2777a;"> -shell-escape</span><span style="color:#d3d0c8;"> book.tex
</span><span style="color:#6699cc;">evince</span><span style="color:#d3d0c8;"> book.pdf
</span></pre>
<div class="next-chapter">
<a href="../02-markdown&#x2f;index.html">
<span>Next chapter: “Markdown”</span>
<span class="icon">
<svg class="icon-arrow-right">
<use xlink:href="../icons.svg#icon-arrow-right">
</svg>
</span>
</a>
</div>
<footer><p>&copy; 2019 Kenton Hamaluik</p></footer>
</article>
</body>
</html>

@ -12,7 +12,7 @@
<meta property="og:url" content="https://hamaluik.github.io/mkbook//02-markdown/01-commonmark.html" />
<meta property="book:author" content="Kenton Hamaluik" />
<meta property="book:release_date" content="2019-12-07T07:42:08.637368460+00:00" />
<meta property="book:release_date" content="2019-12-08T18:56:12.588609853+00:00" />
</head>
<body>
@ -24,7 +24,7 @@
<ol>
<li>
<a href="../01-introduction/index.html">Introduction</a>
<a href="../01-command-line/index.html">Command-line Interface</a>
</li>
@ -111,8 +111,7 @@
</span>
</nav>
<article>
<h1><a href="#commonmark" aria-hidden="true" class="anchor" id="headercommonmark"></a>CommonMark</h1>
<p><em>mkbook</em> nominally utilizes <a href="https://commonmark.org/">CommonMark</a> with some <a href="https://github.github.com/gfm/">GFM</a> extensions through the use of the <a href="https://crates.io/crates/comrak">comrak</a> crate. In using <em>comrak</em>, a specific set of options are used, which are listed here:</p>
<p><em>mkbook</em> nominally utilizes <a href="https://commonmark.org/">CommonMark</a> with some <a href="https://github.github.com/gfm/">GFM</a> extensions through the use of the <a href="https://crates.io/crates/comrak">comrak</a> crate. In using <em>comrak</em>, a specific set of options are used, which are listed here:</p>
<pre style="background-color:#2d2d2d;">
<span style="color:#cc99cc;">let</span><span style="color:#d3d0c8;"> options: ComrakOptions = ComrakOptions {
</span><span style="color:#d3d0c8;"> hardbreaks: </span><span style="color:#f99157;">false</span><span style="color:#d3d0c8;">,
@ -139,7 +138,6 @@
<li><a href="https://github.github.com/gfm/#autolinks-extension-">Autolinks</a></li>
<li><a href="https://github.github.com/gfm/#task-list-items-extension-">Task Lists</a></li>
<li>Superscripts (<code>e = mc^2^.</code><code>e = mc&lt;sup&gt;2&lt;/sup&gt;.</code>)</li>
<li><a href="https://kramdown.gettalong.org/syntax.html#footnotes">Footnotes</a></li>
<li>Description Lists:<pre style="background-color:#2d2d2d;">
<span style="color:#d3d0c8;">First term
</span><span style="color:#d3d0c8;">

@ -12,7 +12,7 @@
<meta property="og:url" content="https://hamaluik.github.io/mkbook//02-markdown/02-syntax-highlighting.html" />
<meta property="book:author" content="Kenton Hamaluik" />
<meta property="book:release_date" content="2019-12-07T07:42:08.637368460+00:00" />
<meta property="book:release_date" content="2019-12-08T18:56:12.588609853+00:00" />
</head>
<body>
@ -24,7 +24,7 @@
<ol>
<li>
<a href="../01-introduction/index.html">Introduction</a>
<a href="../01-command-line/index.html">Command-line Interface</a>
</li>
@ -111,8 +111,7 @@
</span>
</nav>
<article>
<h1><a href="#syntax-highlighting" aria-hidden="true" class="anchor" id="headersyntax-highlighting"></a>Syntax Highlighting</h1>
<p>GFM syntax highlighting is also available by using fenced code tags with a label denoting the language, as such:</p>
<p>GFM syntax highlighting is also available by using fenced code tags with a label denoting the language, as such:</p>
<pre style="background-color:#2d2d2d;">
<span style="color:#d3d0c8;">```c++
</span><span style="color:#d3d0c8;">#include &lt;stdio&gt;
@ -294,7 +293,7 @@
<p>JSON</p>
</dt>
<dd>
<p><code>json</code>, <code>sublime-settings</code>, <code>sublime-menu</code>, <code>sublime-keymap</code>, <code>sublime-mousemap</code>, <code>sublime-theme</code>, <code>sublime-build</code>, <code>sublime-project</code>, <code>sublime-completions</code>, <code>sublime-commands</code>, <code>sublime-macro</code>, <code>sublime-color-scheme</code></p>
<p><code>json</code></p>
</dd>
<dt>
<p>Java</p>

@ -12,7 +12,7 @@
<meta property="og:url" content="https://hamaluik.github.io/mkbook//02-markdown/03-plantuml-diagrams.html" />
<meta property="book:author" content="Kenton Hamaluik" />
<meta property="book:release_date" content="2019-12-07T07:42:08.637368460+00:00" />
<meta property="book:release_date" content="2019-12-08T18:56:12.588609853+00:00" />
</head>
<body>
@ -24,7 +24,7 @@
<ol>
<li>
<a href="../01-introduction/index.html">Introduction</a>
<a href="../01-command-line/index.html">Command-line Interface</a>
</li>
@ -111,8 +111,7 @@
</span>
</nav>
<article>
<h1><a href="#plantuml-diagrams" aria-hidden="true" class="anchor" id="headerplantuml-diagrams"></a>PlantUML Diagrams</h1>
<p>If you have <a href="http://plantuml.com/">PlantUML</a> installed and available on your path, <em>mkbook</em> will try to render any code blocks with a language tag of <code>plantuml</code> as inline SVG images.</p>
<p>If you have <a href="http://plantuml.com/">PlantUML</a> installed and available on your path, <em>mkbook</em> will try to render any code blocks with a language tag of <code>plantuml</code> as inline SVG images.</p>
<p>For example:</p>
<pre style="background-color:#2d2d2d;">
<span style="color:#d3d0c8;">```plantuml

@ -12,7 +12,7 @@
<meta property="og:url" content="https://hamaluik.github.io/mkbook//02-markdown/04-katex-formulas.html" />
<meta property="book:author" content="Kenton Hamaluik" />
<meta property="book:release_date" content="2019-12-07T07:42:08.637368460+00:00" />
<meta property="book:release_date" content="2019-12-08T18:56:12.588609853+00:00" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.11.1/dist/katex.min.css" integrity="sha384-zB1R0rpPzHqg7Kpt0Aljp8JPLqbXI3bhnPWROx27a9N0Ll6ZP/+DiW/UqRcLbRjq" crossorigin="anonymous">
</head>
<body>
@ -24,7 +24,7 @@
<ol>
<li>
<a href="../01-introduction/index.html">Introduction</a>
<a href="../01-command-line/index.html">Command-line Interface</a>
</li>
@ -111,8 +111,7 @@
</span>
</nav>
<article>
<h1><a href="#katex-math-formulas" aria-hidden="true" class="anchor" id="headerkatex-math-formulas"></a>KaTeX (Math) Formulas</h1>
<p>If you have <a href="https://github.com/KaTeX/KaTeX">KaTeX</a> installed and available on your path, <em>mkbook</em> will try to render any code blocks with a language tag of <code>katex</code> as inline math blocks.</p>
<p>If you have <a href="https://github.com/KaTeX/KaTeX">KaTeX</a> installed and available on your path, <em>mkbook</em> will try to render any code blocks with a language tag of <code>katex</code> as inline math blocks.</p>
<p>For example:</p>
<pre style="background-color:#2d2d2d;">
<span style="color:#d3d0c8;">```katex

@ -12,7 +12,7 @@
<meta property="og:url" content="https://hamaluik.github.io/mkbook//02-markdown/05-images.html" />
<meta property="book:author" content="Kenton Hamaluik" />
<meta property="book:release_date" content="2019-12-07T07:42:08.637368460+00:00" />
<meta property="book:release_date" content="2019-12-08T18:56:12.588609853+00:00" />
</head>
<body>
@ -24,7 +24,7 @@
<ol>
<li>
<a href="../01-introduction/index.html">Introduction</a>
<a href="../01-command-line/index.html">Command-line Interface</a>
</li>
@ -111,8 +111,7 @@
</span>
</nav>
<article>
<h1><a href="#images" aria-hidden="true" class="anchor" id="headerimages"></a>Images</h1>
<p>To include an image, use the standard markdown format:</p>
<p>To include an image, use the standard markdown format:</p>
<pre style="background-color:#2d2d2d;">
<span style="color:#f99157;">![alt](url </span><span style="color:#d3d0c8;">&quot;</span><span style="color:#f2777a;">title</span><span style="color:#d3d0c8;">&quot;</span><span style="color:#f99157;">)
</span></pre>

@ -12,7 +12,7 @@
<meta property="og:url" content="https://hamaluik.github.io/mkbook//02-markdown/06-tables.html" />
<meta property="book:author" content="Kenton Hamaluik" />
<meta property="book:release_date" content="2019-12-07T07:42:08.637368460+00:00" />
<meta property="book:release_date" content="2019-12-08T18:56:12.588609853+00:00" />
</head>
<body>
@ -24,7 +24,7 @@
<ol>
<li>
<a href="../01-introduction/index.html">Introduction</a>
<a href="../01-command-line/index.html">Command-line Interface</a>
</li>

@ -12,7 +12,7 @@
<meta property="og:url" content="https://hamaluik.github.io/mkbook//02-markdown/07-task-lists.html" />
<meta property="book:author" content="Kenton Hamaluik" />
<meta property="book:release_date" content="2019-12-07T07:42:08.637368460+00:00" />
<meta property="book:release_date" content="2019-12-08T18:56:12.588609853+00:00" />
</head>
<body>
@ -24,7 +24,7 @@
<ol>
<li>
<a href="../01-introduction/index.html">Introduction</a>
<a href="../01-command-line/index.html">Command-line Interface</a>
</li>

@ -12,7 +12,7 @@
<meta property="og:url" content="https://hamaluik.github.io/mkbook//02-markdown/index.html" />
<meta property="book:author" content="Kenton Hamaluik" />
<meta property="book:release_date" content="2019-12-07T07:42:08.637368460+00:00" />
<meta property="book:release_date" content="2019-12-08T18:56:12.588609853+00:00" />
</head>
<body>
@ -24,7 +24,7 @@
<ol>
<li>
<a href="../01-introduction/index.html">Introduction</a>
<a href="../01-command-line/index.html">Command-line Interface</a>
</li>
@ -84,7 +84,7 @@
</a>
<a href="../01-introduction&#x2f;index.html" alt="Introduction">
<a href="../01-command-line&#x2f;index.html" alt="Command-line Interface">
<span class="icon">
<svg class="icon-arrow-up">
@ -111,15 +111,15 @@
</span>
</nav>
<article>
<h1><a href="#markdown" aria-hidden="true" class="anchor" id="headermarkdown"></a>Markdown</h1>
<p><em>mkbook</em> relies pretty extensively on <a href="https://daringfireball.net/projects/markdown/">Markdown</a> for its ease of use. If youre not familiar with <em>Markdown</em>, it is a simple markup language that is design to be easy to read and write in plain text, and then (relatively) easy for a computer to convert into other formats such as HTML or LaTeX.</p>
<p><em>mkbook</em> relies pretty extensively on <a href="https://daringfireball.net/projects/markdown/">Markdown</a> for its ease of use. If youre not familiar with <em>Markdown</em>, it is a simple markup language that is design to be easy to read and write in plain text, and then (relatively) easy for a computer to convert into other formats such as HTML or LaTeX.</p>
<p>The above paragraph looks like this:</p>
<pre style="background-color:#2d2d2d;">
<span style="font-style:italic;color:#cc99cc;">_mkbook_</span><span style="color:#d3d0c8;"> relies pretty extensively on
</span><span style="color:#f99157;">[Markdown](https://daringfireball.net/projects/markdown/)</span><span style="color:#d3d0c8;"> for its ease of use.
</span><span style="color:#d3d0c8;">If you&#39;re not familiar with </span><span style="font-style:italic;color:#cc99cc;">_Markdown_</span><span style="color:#d3d0c8;">, it is a simple markup language that is
</span><span style="color:#d3d0c8;">design to be easy to read and write in plain text, and then (relatively) easy
</span><span style="color:#d3d0c8;">for a computer to convert into other formats such as HTML or LaTeX.
</span><span style="color:#f99157;">[Markdown](https://daringfireball.net/projects/markdown/)</span><span style="color:#d3d0c8;"> for
</span><span style="color:#d3d0c8;">its ease of use. If you&#39;re not familiar with </span><span style="font-style:italic;color:#cc99cc;">_Markdown_</span><span style="color:#d3d0c8;">, it is
</span><span style="color:#d3d0c8;">a simple markup language that is designed to be easy to read
</span><span style="color:#d3d0c8;">and write in plain text, and then (relatively) easy for a
</span><span style="color:#d3d0c8;">computer to convert into other formats such as HTML or LaTeX.
</span></pre>
<p><em>Markdown</em> by itself isnt quite enough for most purposes, so <em>mkbook</em> actually uses the <em>CommonMark</em> spec with some additional extensions to make life easier.</p>

@ -12,7 +12,7 @@
<meta property="og:url" content="https://hamaluik.github.io/mkbook//03-frontmatter/index.html" />
<meta property="book:author" content="Kenton Hamaluik" />
<meta property="book:release_date" content="2019-12-07T07:42:08.637368460+00:00" />
<meta property="book:release_date" content="2019-12-08T18:56:12.588609853+00:00" />
</head>
<body>
@ -24,7 +24,7 @@
<ol>
<li>
<a href="../01-introduction/index.html">Introduction</a>
<a href="../01-command-line/index.html">Command-line Interface</a>
</li>
@ -111,8 +111,7 @@
</span>
</nav>
<article>
<h1><a href="#front-matter" aria-hidden="true" class="anchor" id="headerfront-matter"></a>Front Matter</h1>
<p>Each <code>.md</code> file can optionally contain a header with metadata describing the document. If the header isnt present, or if any keys are missing, default values will be used.</p>
<p>Each <code>.md</code> file can optionally contain a header with metadata describing the document. If the header isnt present, or if any keys are missing, default values will be used.</p>
<p>To insert a header into a <code>.md</code> file, insert three dashes (<code>---</code>), followed by a new-line, followed by the front matter contents, followed by a newline, then another three dashes and a new-line. The metadata is in the <a href="https://github.com/toml-lang/toml">TOML</a> format, so for example the front-matter (and first line) for a file could look like this:</p>
<pre style="background-color:#2d2d2d;">
<span style="background-color:#515151;color:#d3d0c8;">---
@ -121,11 +120,9 @@
</span><span style="color:#d3d0c8;">pubdate = 2019-11-29T15:22:00-07:00
</span><span style="color:#6699cc;">---
</span><span style="color:#d3d0c8;">
</span><span style="color:#6699cc;"># Front Matter
</span><span style="color:#d3d0c8;">
</span><span style="color:#d3d0c8;">Each </span><span style="color:#99cc99;">`.md`</span><span style="color:#d3d0c8;"> file can optionally contain a header with metadata describing the document. If the header isn&#39;t present, or if any keys are missing, default values will be used.
</span></pre>
<h2><a href="#supported-keys" aria-hidden="true" class="anchor" id="headersupported-keys"></a>Supported Keys</h2>
<h1><a href="#supported-keys" aria-hidden="true" class="anchor" id="headersupported-keys"></a>Supported Keys</h1>
<p>The list of supported keys is subject to change, but for now it is as follows:</p>
<dl><dt>
<p>title</p>

@ -12,7 +12,7 @@
<meta property="og:url" content="https://hamaluik.github.io/mkbook//04-structure/index.html" />
<meta property="book:author" content="Kenton Hamaluik" />
<meta property="book:release_date" content="2019-12-07T07:42:08.637368460+00:00" />
<meta property="book:release_date" content="2019-12-08T18:56:12.588609853+00:00" />
</head>
<body>
@ -24,7 +24,7 @@
<ol>
<li>
<a href="../01-introduction/index.html">Introduction</a>
<a href="../01-command-line/index.html">Command-line Interface</a>
</li>
@ -111,9 +111,8 @@
</span>
</nav>
<article>
<h1><a href="#structure" aria-hidden="true" class="anchor" id="headerstructure"></a>Structure</h1>
<p><em>mkbook</em> follows a fairly simple directory structure for now, with a <code>README.md</code> file declaring the books metadata, and <code>.md</code> files defining each chapter of the book.</p>
<h2><a href="#readmemd" aria-hidden="true" class="anchor" id="headerreadmemd"></a><code>README.md</code></h2>
<p><em>mkbook</em> follows a fairly simple directory structure for now, with a <code>README.md</code> file declaring the books metadata, and <code>.md</code> files defining each chapter of the book.</p>
<h1><a href="#readmemd" aria-hidden="true" class="anchor" id="headerreadmemd"></a>README.md</h1>
<p><em>mkbook</em> generally requires a <code>README.md</code> file to reside in your source directory. This file is responsible for defining the metadata associated with your book:</p>
<ul>
<li>The books title (<code>title</code>)</li>
@ -123,7 +122,7 @@
<li>A markdown-formatted description of the book</li>
</ul>
<p>If the <code>README.md</code> file or any of the entries are missing, default values will be used. The <code>README.md</code> file should be formatted as any other page, with the <code>title</code>, <code>author</code>, <code>pubdate</code>, and <code>url</code> specified in the frontmatter, and the book description the <em>Markdown</em> contents of the <code>README.md</code> file.</p>
<h3><a href="#sample" aria-hidden="true" class="anchor" id="headersample"></a>Sample</h3>
<h2><a href="#sample" aria-hidden="true" class="anchor" id="headersample"></a>Sample</h2>
<pre style="background-color:#2d2d2d;">
<span style="background-color:#515151;color:#d3d0c8;">---
</span><span style="color:#d3d0c8;">title = &quot;The mkbook Book&quot;
@ -140,7 +139,7 @@
</span><span style="color:#d3d0c8;">to be a more minimal alternative that is customized more towards my needs and
</span><span style="color:#d3d0c8;">desires than anything else.
</span></pre>
<h3><a href="#default-values" aria-hidden="true" class="anchor" id="headerdefault-values"></a>Default Values</h3>
<h2><a href="#default-values" aria-hidden="true" class="anchor" id="headerdefault-values"></a>Default Values</h2>
<dl><dt>
<p><code>title</code></p>
</dt>
@ -172,13 +171,13 @@
<p>“”</p>
</dd>
</dl>
<h2><a href="#assets" aria-hidden="true" class="anchor" id="headerassets"></a>Assets</h2>
<h1><a href="#assets" aria-hidden="true" class="anchor" id="headerassets"></a>Assets</h1>
<p>Any files in the <code>src</code> directory which are not included in <code>.gitignore</code> and do not end in the extension <code>.md</code> will be copied to the output folder. You can use this to include images, files, etc, for example the following image is an asset bundled with the book:</p>
<pre style="background-color:#2d2d2d;">
<span style="color:#f99157;">![chapter-six](book-chapter-six-5834.jpg </span><span style="color:#d3d0c8;">&quot;</span><span style="color:#f2777a;">Photo by Kaboompics.com from Pexels</span><span style="color:#d3d0c8;">&quot;</span><span style="color:#f99157;">)
</span></pre>
<figure><img src="../book-chapter-six-5834.jpg" alt="chapter-six" title="Photo by Kaboompics.com from Pexels"><figcaption>Photo by Kaboompics.com from Pexels</figcaption></figure>
<h2><a href="#documents" aria-hidden="true" class="anchor" id="headerdocuments"></a>Documents</h2>
<h1><a href="#documents" aria-hidden="true" class="anchor" id="headerdocuments"></a>Documents</h1>
<p><em>mkbook</em> works on mostly a flat directory structure, however one level of sub-directories are supported in order to create sections within chapters. Files that dont end in a <code>.md</code> extension are completely ignored. Each <code>.md</code> file in the root source directly is its own chapter. To create chapters with sub-sections, create a sub-directory in the root directory and then create a <code>README.md</code> file, which will become the root of the chapter, with all <code>.md</code> files in the sub-directory becoming sections in the chapter. The <code>title</code> in the <code>README.md</code> files frontmatter will be used as the name of the chapter.</p>
<p>The order of the book is based on the alphabetical order of the file names (actually its based on Rusts <a href="https://doc.rust-lang.org/std/cmp/trait.PartialOrd.html#impl-PartialOrd%3Cstr%3E">implementation of <code>PartialOrd</code> for str</a>). Thus, it is recommended to lay out your book chapters with manual numbering of the file names, as such:</p>
<pre style="background-color:#2d2d2d;">

@ -12,7 +12,7 @@
<meta property="og:url" content="https://hamaluik.github.io/mkbook//05-customization/index.html" />
<meta property="book:author" content="Kenton Hamaluik" />
<meta property="book:release_date" content="2019-12-07T07:42:08.637368460+00:00" />
<meta property="book:release_date" content="2019-12-08T18:56:12.588609853+00:00" />
</head>
<body>
@ -24,7 +24,7 @@
<ol>
<li>
<a href="../01-introduction/index.html">Introduction</a>
<a href="../01-command-line/index.html">Command-line Interface</a>
</li>
@ -111,8 +111,7 @@
</span>
</nav>
<article>
<h1><a href="#customization" aria-hidden="true" class="anchor" id="headercustomization"></a>Customization</h1>
<p>There isnt any way to customize the templates nor the CSS yet, though I will investigate this if the need arises. This is because both the templates and CSS are currently compiled at compile-time instead of run-time.</p>
<p>There isnt any way to customize the templates nor the CSS yet, though I will investigate this if the need arises. This is because both the templates and CSS are currently compiled at compile-time instead of run-time.</p>

@ -12,7 +12,7 @@
<meta property="og:url" content="https://hamaluik.github.io/mkbook//06-how-it-works/index.html" />
<meta property="book:author" content="Kenton Hamaluik" />
<meta property="book:release_date" content="2019-12-07T07:42:08.637368460+00:00" />
<meta property="book:release_date" content="2019-12-08T18:56:12.588609853+00:00" />
</head>
<body>
@ -24,7 +24,7 @@
<ol>
<li>
<a href="../01-introduction/index.html">Introduction</a>
<a href="../01-command-line/index.html">Command-line Interface</a>
</li>
@ -105,24 +105,23 @@
</span>
</nav>
<article>
<h1><a href="#how-it-works" aria-hidden="true" class="anchor" id="headerhow-it-works"></a>How it Works</h1>
<p><em>mkbook</em> generates a completely static, javascript-free website from a series of Markdown files. All of the layout and styling is controlled purely by hand-crafted CSS specific to this books purpose.</p>
<h2><a href="#assets" aria-hidden="true" class="anchor" id="headerassets"></a>Assets</h2>
<p><em>mkbook</em> generates a completely static, javascript-free website from a series of Markdown files. All of the layout and styling is controlled purely by hand-crafted CSS specific to this books purpose.</p>
<h1><a href="#assets" aria-hidden="true" class="anchor" id="headerassets"></a>Assets</h1>
<p><em>mkbook</em> currently bundles two assets which get written into the book directory: <code>favicon.ico</code>, and <code>icons.svg</code>. <code>favicon.ico</code> is the <a href="https://fontawesome.com/icons/book?style=solid">Font Awesome 5 book icon</a>, and <code>icons.svg</code> contains 3 <a href="https://fontawesome.com/">Font Awesome 5</a> arrow icons: <a href="https://fontawesome.com/icons/arrow-left?style=solid">arrow-left</a>, <a href="https://fontawesome.com/icons/arrow-right?style=solid">arrow-right</a>, and <a href="https://fontawesome.com/icons/arrow-up?style=solid">arrow-up</a> which are used for navigation. These files are compiled into the <em>mkbook</em> binary using the <a href="https://doc.rust-lang.org/std/macro.include_bytes.html"><code>include_bytes!</code> macro</a>, and written to the output folder on each build.</p>
<h2><a href="#styling" aria-hidden="true" class="anchor" id="headerstyling"></a>Styling</h2>
<h1><a href="#styling" aria-hidden="true" class="anchor" id="headerstyling"></a>Styling</h1>
<p><em>mkbook</em> utilizes <a href="https://sass-lang.com/">Sass</a> to define its styles; you can view the sources <a href="https://github.com/hamaluik/mkbook/tree/master/style">on github</a>. In <em>mkbook</em>s build script, the styles are compiled from their native <code>.scss</code> format into a single, compressed <code>.css</code> file using <a href="https://crates.io/crates/sass-rs">sass-rs</a>. The resulting <code>.css</code> file is then bundled into the binary using the <a href="https://doc.rust-lang.org/std/macro.include_str.html"><code>include_str!</code> macro</a>. When a book is generated, this <code>.css</code> is written to the output folder as <code>style.css</code>, where it is included by each generated <code>.html</code> file.</p>
<h2><a href="#templates" aria-hidden="true" class="anchor" id="headertemplates"></a>Templates</h2>
<h1><a href="#templates" aria-hidden="true" class="anchor" id="headertemplates"></a>Templates</h1>
<p><em>mkbook</em> contains two template files: one for the index, and one for each page / chapter, and uses <a href="https://crates.io/crates/askama">Askama</a> to render the templates. Since the <em>Askama</em> templates are compiled when <em>mkbook</em> is compiled, it is not currently possible to change the templates at run time. You can view the sources for these templates <a href="https://github.com/hamaluik/mkbook/tree/master/templates">on github</a>.</p>
<h2><a href="#markdown-formatting" aria-hidden="true" class="anchor" id="headermarkdown-formatting"></a>Markdown Formatting</h2>
<h1><a href="#markdown-formatting" aria-hidden="true" class="anchor" id="headermarkdown-formatting"></a>Markdown Formatting</h1>
<p>Markdown is formatted usiing <a href="https://crates.io/crates/comrak">comrak</a> with some specific options, see the <a href="02-markdown.html">Markdown chapter</a> for more information.</p>
<h2><a href="#syntax-highlighting" aria-hidden="true" class="anchor" id="headersyntax-highlighting"></a>Syntax Highlighting</h2>
<h1><a href="#syntax-highlighting" aria-hidden="true" class="anchor" id="headersyntax-highlighting"></a>Syntax Highlighting</h1>
<p>Code is syntax-highlighted using <a href="https://crates.io/crates/syntect">syntect</a> with the default langauges and the <code>base16-eighties</code> colour scheme. Some additional languages above the base list supported by <em>syntect</em> have been aded:</p>
<ul>
<li><code>haxe</code></li>
<li><code>hxml</code></li>
<li><code>sass</code></li>
<li><code>scss</code></li>
<li><code>toml</code></li>
<li><a href="https://haxe.org/"><code>haxe</code></a></li>
<li><a href="https://haxe.org/manual/compiler-usage-hxml.html"><code>hxml</code></a></li>
<li><a href="https://sass-lang.com/documentation/syntax#the-indented-syntax"><code>sass</code></a></li>
<li><a href="https://sass-lang.com/documentation/syntax"><code>scss</code></a></li>
<li><a href="https://github.com/toml-lang/toml"><code>toml</code></a></li>
</ul>

@ -10,22 +10,24 @@
<meta property="og:site_name" content="The mkbook Book" />
<meta property="og:type" content="book" />
<meta property="og:url" content="https://hamaluik.github.io/mkbook/" />
<meta property="og:description" content="&lt;p&gt;&lt;em&gt;mkbook&lt;&#x2f;em&gt; is my simpler alternative to &lt;a href=&quot;https:&#x2f;&#x2f;crates.io&#x2f;crates&#x2f;mdbook&quot;&gt;mdbook&lt;&#x2f;a&gt; which is a great tool, but for which I really dislike some of the decisions they took, such as relying on javascript for highlighting and navigation, and including a lot of bells and whistles such as javascript-based search.&lt;&#x2f;p&gt;
<meta property="og:description" content="&lt;p&gt;&lt;em&gt;mkbook&lt;&#x2f;em&gt; is my simpler alternative to &lt;a href=&quot;https:&#x2f;&#x2f;crates.io&#x2f;crates&#x2f;mdbook&quot;&gt;&lt;em&gt;mdbook&lt;&#x2f;em&gt;&lt;&#x2f;a&gt; which is a great tool, however I really dislike some of the decisions they tooksuch as relying on javascript for highlighting and navigation and including a lot of bells and whistles such as javascript-based search.&lt;&#x2f;p&gt;
&lt;p&gt;This tool aims to work somewhat similarly to &lt;em&gt;mdbook&lt;&#x2f;em&gt;, but is generally intended to be a more minimal alternative that is customized more towards my needs and desires than anything else.&lt;&#x2f;p&gt;
&lt;p&gt;If youre not familiar with &lt;em&gt;mdbook&lt;&#x2f;em&gt;, &lt;em&gt;mkbook&lt;&#x2f;em&gt; is a tool to convert a collection of &lt;a href=&quot;https:&#x2f;&#x2f;commonmark.org&#x2f;&quot;&gt;Markdown&lt;&#x2f;a&gt; files into a static website &#x2f; book which can be published online. It was created to help me write documentation with minimum fuss while presenting it in an easy-to-consume manner.&lt;&#x2f;p&gt;
" />
<meta property="book:author" content="Kenton Hamaluik" />
<meta property="book:release_date" content="2019-12-07T07:42:08.637368460+00:00" />
<meta property="book:release_date" content="2019-12-08T18:56:12.588609853+00:00" />
</head>
<body class="toc">
<header>
<h1>The mkbook Book</h1>
<h2>by Kenton Hamaluik</h2>
<time datetime="2019-12-07T07:42:08.637368460+00:00">Dec 7, 2019</time>
<time datetime="2019-12-08T18:56:12.588609853+00:00">Dec 8, 2019</time>
</header>
<article>
<p><em>mkbook</em> is my simpler alternative to <a href="https://crates.io/crates/mdbook">mdbook</a> which is a great tool, but for which I really dislike some of the decisions they took, such as relying on javascript for highlighting and navigation, and including a lot of bells and whistles such as javascript-based search.</p>
<p><em>mkbook</em> is my simpler alternative to <a href="https://crates.io/crates/mdbook"><em>mdbook</em></a> which is a great tool, however I really dislike some of the decisions they took—such as relying on javascript for highlighting and navigation and including a lot of bells and whistles such as javascript-based search.</p>
<p>This tool aims to work somewhat similarly to <em>mdbook</em>, but is generally intended to be a more minimal alternative that is customized more towards my needs and desires than anything else.</p>
<p>If youre not familiar with <em>mdbook</em>, <em>mkbook</em> is a tool to convert a collection of <a href="https://commonmark.org/">Markdown</a> files into a static website / book which can be published online. It was created to help me write documentation with minimum fuss while presenting it in an easy-to-consume manner.</p>
</article>
<nav>
@ -33,7 +35,7 @@
<ol>
<li>
<a href="01-introduction/index.html">Introduction</a>
<a href="01-command-line/index.html">Command-line Interface</a>
</li>

@ -64,26 +64,26 @@ fn format_text<'a>(node: &'a comrak::nodes::AstNode<'a>, output: &mut String) {
// output.push_str("}");
// }
//},
//NodeValue::Emph => {
// output.push_str("\\emph{");
// for child in node.children() { format_text(child, output); }
// output.push_str("}");
//},
//NodeValue::Strong => {
// output.push_str("\\textbf{");
// for child in node.children() { format_text(child, output); }
// output.push_str("}");
//},
//NodeValue::Strikethrough => {
// output.push_str("\\sout{");
// for child in node.children() { format_text(child, output); }
// output.push_str("}");
//},
//NodeValue::Superscript => {
// output.push_str("\\textsuperscript{");
// for child in node.children() { format_text(child, output); }
// output.push_str("}");
//},
NodeValue::Emph => {
output.push_str("\\emph{");
for child in node.children() { format_text(child, output); }
output.push_str("}");
},
NodeValue::Strong => {
output.push_str("\\textbf{");
for child in node.children() { format_text(child, output); }
output.push_str("}");
},
NodeValue::Strikethrough => {
output.push_str("\\sout{");
for child in node.children() { format_text(child, output); }
output.push_str("}");
},
NodeValue::Superscript => {
output.push_str("\\textsuperscript{");
for child in node.children() { format_text(child, output); }
output.push_str("}");
},
_ => for child in node.children() { format_text(child, output); },
}
}
@ -148,9 +148,8 @@ fn format_node<'a>(section_offset: u32, node: &'a comrak::nodes::AstNode<'a>, ou
output.push_str("\\end{equation}\n");
return;
}
let lang = if lang.trim().is_empty() { "text" } else { lang };
output.push_str("\\begin{absolutelynopagebreak}\n\\begin{minted}[breaklines]{");
output.push_str("\\begin{absolutelynopagebreak}\n\\begin{minted}[breaklines,baselinestretch=1.2,bgcolor=light-grey,fontsize=\\footnotesize,]{");
output.push_str(&escape_text(lang));
output.push_str("}\n");
output.push_str(source);
@ -179,7 +178,7 @@ fn format_node<'a>(section_offset: u32, node: &'a comrak::nodes::AstNode<'a>, ou
_ => output.push_str("\\textbf{"),
}
for child in node.children() { format_text(child, output); }
output.push_str("}");
output.push_str("}\n\n");
},
NodeValue::ThematicBreak => {
output.push_str("\\hline\n");
@ -204,14 +203,14 @@ fn format_node<'a>(section_offset: u32, node: &'a comrak::nodes::AstNode<'a>, ou
TableAlignment::Right => "r",
}).collect::<Vec<&str>>().join(" ");
output.push_str("\\begin{tabular}{");
output.push_str("\\begin{center}\n\\begin{tabular}{");
output.push_str(&spec);
output.push_str("}\n");
let mut rows: String = String::default();
for child in node.children() { format_node(section_offset, child, &mut rows); }
output.push_str(rows.trim());
output.push_str("\\end{tabular}\n");
output.push_str("\\end{tabular}\n\\end{center}\n\n");
},
NodeValue::TableRow(header) => {
let row: String = node.children().map(|child| {

@ -1,4 +1,4 @@
\documentclass{book}
\documentclass[twoside, 10pt]{book}
% booklet-sized pages
\usepackage[papersize={5.5in, 8.5in}]{geometry}
@ -18,6 +18,8 @@
\allsectionsfont{\sffamily}
% syntax highlighting
\usepackage{xcolor}
\definecolor{light-grey}{gray}{0.975}
\usepackage{minted}
\usemintedstyle{vs}
@ -36,11 +38,8 @@
\usepackage{amsmath}
\usepackage{amssymb}
% make the TOC work with our preface
\makeatletter
\renewcommand{\frontmatter}{\cleardoublepage\@mainmatterfalse}
\renewcommand{\mainmatter}{\cleardoublepage\@mainmattertrue}
\makeatother
% better lists
\usepackage{enumitem}
\title{ {{ front.title }} }
\author{ {{ front.author }} }
@ -60,16 +59,15 @@
\textcopyright{} {{ front.pubdate|year }} {{ front.author }}
\end{center}
\vspace*{\fill}
\clearpage
\tableofcontents
\cleardoublepage
\chapter{Preface}
{{ description }}
\mainmatter
\pagestyle{headings}
{% for chapter in chapters %}
\chapter{ {{ chapter.front.title }} }

Loading…
Cancel
Save