added some more chapters and listed supported syntax languages

master
Kenton Hamaluik 5 years ago
parent c4f87aedd8
commit 75c29cd49d

@ -6,6 +6,8 @@ _mkbook_ is my simpler alternative to [_mdbook_](https://crates.io/crates/mdbook
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.
_mkbook_ may be installed using _Cargo_ (`cargo install --force --path .` in the _mkbook_ repo directory), and after that it presents a command-line interface:
```

@ -44,3 +44,111 @@ Mostly, know that the following extensions are enabled:
More details in second paragraph.
```
## Syntax Highlight
GFM syntax highlighting is also available by using fenced code tags with a label denoting the language, as such:
~~~md
```c++
#include <stdio>
int main() {
std::cout << "Hello, world!" << std::endl;
return 0;
}
```
~~~
which results in:
```c++
#include <stdio>
int main() {
std::cout << "Hello, world!" << std::endl;
return 0;
}
```
To denote the language you can either use one the language's extensions as the label, or the full name of the language (which is **not** case-sensitive).
The list of supported languages is currently as follows:
| Language Name | Supported Tags / Extensions |
|:-|:-|
| ASP | `asa` |
| ActionScript | `as` |
| AppleScript | `applescript`, `script editor` |
| Batch File | `bat`, `cmd` |
| BibTeX | `bib` |
| Bourne Again Shell (bash) | `sh`, `bash`, `zsh`, `fish`, `.bash_aliases`, `.bash_completions`, `.bash_functions`, `.bash_login`, `.bash_logout`, `.bash_profile`, `.bash_variables`, `.bashrc`, `.profile`, `.textmate_init` |
| C | `c`, `h` |
| C# | `cs`, `csx` |
| C++ | `cpp`, `cc`, `cp`, `cxx`, `c++`, `C`, `h`, `hh`, `hpp`, `hxx`, `h++`, `inl`, `ipp` |
| CSS | `css`, `css.erb`, `css.liquid` |
| Cargo Build Results | |
| Clojure | `clj` |
| D | `d`, `di` |
| Diff | `diff`, `patch` |
| Erlang | `erl`, `hrl`, `Emakefile`, `emakefile` |
| Go | `go` |
| Graphviz (DOT) | `dot`, `DOT`, `gv` |
| Groovy | `groovy`, `gvy`, `gradle` |
| HTML (ASP) | `asp` |
| HTML (Erlang) | `yaws` |
| HTML (Rails) | `rails`, `rhtml`, `erb`, `html.erb` |
| HTML (Tcl) | `adp` |
| HTML | `html`, `htm`, `shtml`, `xhtml`, `inc`, `tmpl`, `tpl` |
| Haskell | `hs` |
| 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` |
| Java Properties | `properties` |
| Java Server Page (JSP) | `jsp` |
| Java | `java`, `bsh` |
| JavaDoc | |
| JavaScript (Rails) | `js.erb` |
| JavaScript | `js`, `htc` |
| LaTeX Log | |
| LaTeX | `tex`, `ltx` |
| Lisp | `lisp`, `cl`, `clisp`, `l`, `mud`, `el`, `scm`, `ss`, `lsp`, `fasl` |
| Literate Haskell | `lhs` |
| Lua | `lua` |
| MATLAB | `matlab` |
| Make Output | |
| Makefile | `make`, `GNUmakefile`, `makefile`, `Makefile`, `OCamlMakefile`, `mak`, `mk` |
| Markdown | `md`, `mdown`, `markdown`, `markdn` |
| MultiMarkdown | |
| NAnt Build File | `build` |
| OCaml | `ml`, `mli` |
| OCamllex | `mll` |
| OCamlyacc | `mly` |
| Objective-C | `m`, `h` |
| Objective-C++ | `mm`, `M`, `h` |
| PHP Source | |
| PHP | `php`, `php3`, `php4`, `php5`, `php7`, `phps`, `phpt`, `phtml` |
| Pascal | `pas`, `p`, `dpr` |
| Perl | `pl`, `pm`, `pod`, `t`, `PL` |
| Plain Text | `txt` |
| Python | `py`, `py3`, `pyw`, `pyi`, `pyx`, `pyx.in`, `pxd`, `pxd.in`, `pxi`, `pxi.in`, `rpy`, `cpy`, `SConstruct`, `Sconstruct`, `sconstruct`, `SConscript`, `gyp`, `gypi`, `Snakefile`, `wscript` |
| R Console | |
| R | `R`, `r`, `s`, `S`, `Rprofile` |
| Rd (R Documentation) | `rd` |
| Regular Expression | `re` |
| Regular Expressions (Javascript) | |
| Regular Expressions (Python) | |
| Ruby Haml | `haml`, `sass` |
| Ruby on Rails | `rxml`, `builder` |
| Ruby | `rb`, `Appfile`, `Appraisals`, `Berksfile`, `Brewfile`, `capfile`, `cgi`, `Cheffile`, `config.ru`, `Deliverfile`, `Fastfile`, `fcgi`, `Gemfile`, `gemspec`, `Guardfile`, `irbrc`, `jbuilder`, `podspec`, `prawn`, `rabl`, `rake`, `Rakefile`, `Rantfile`, `rbx`, `rjs`, `ruby.rail`, `Scanfile`, `simplecov`, `Snapfile`, `thor`, `Thorfile`, `Vagrantfile` |
| Rust | `rs` |
| SQL (Rails) | `erbsql`, `sql.erb` |
| SQL | `sql`, `ddl`, `dml` |
| Scala | `scala`, `sbt` |
| Shell-Unix-Generic | |
| Tcl | `tcl` |
| TeX | `sty`, `cls` |
| Textile | `textile` |
| XML | `xml`, `xsd`, `xslt`, `tld`, `dtml`, `rss`, `opml`, `svg` |
| YAML | `yaml`, `yml`, `sublime-syntax` |
| camlp4 | |
| commands-builtin-shell-bash | |
| reStructuredText | `rst`, `rest` |

@ -2,7 +2,54 @@
title = "Structure"
---
_mkbook_ currently only supports two types of assets to use in rendering: assets (images, etc), and documents (markdown files).
_mkbook_ follows a fairly simple directory structure for now, with a `mkbook.toml` file declaring the book's metadata, and `.md` files defining each chapter of the book.
## `mkbook.toml`
_mkbook_ generally requires a `mkbook.toml` file to reside in your source directory. This file is responsible for defining the metadata associated with your book:
* The book's title (`title`)
* The book's author (`author`)
* The publication date (`pubdate`)
* The canonical URL for the book (`url`)
* A markdown-formatted description of the book (`description`)
If the `mkbook.toml` file or any of the entries are missing, default values will be used.
### Sample
```toml
title = "The mkbook Book"
author = "Kenton Hamaluik"
url = "https://hamaluik.github.io/mkbook/"
description = """
_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.
"""
```
### Default Values
`title`
: "My Cool Book"
`author`
: "Anonymous"
`pubdate`
: The date the book was built from the command line, in UTC time
`url`
: ""
`description`
: ""
## Assets
@ -16,6 +63,7 @@ For now, _mkbook_ only works on a flat list of markdown files, with the intent o
```
src/
├── mkbook.toml
├── 00-foreword.md
├── 01-introduction.md
├── 02-my-first-chapter.md

@ -0,0 +1,5 @@
---
title = "Customization"
---
There isn't any way to customize the templates nor the CSS yet, though I will investigate this if the need arises.

@ -0,0 +1,25 @@
---
title = "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
_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
_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
_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 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
Code is syntax-highlighted using [syntect](https://crates.io/crates/syntect) with the default langauges and the `base16-eighties` colour scheme.

@ -14,7 +14,7 @@
&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;
" />
<meta property="book:author" content="Kenton Hamaluik" />
<meta property="book:release_date" content="2019-11-28T18:22:59.188707583+00:00" />
<meta property="book:release_date" content="2019-11-28T19:18:47.381384897+00:00" />
</head>
<body>
<nav class="big">
@ -32,6 +32,10 @@
<li><a href="04-structure.html">Structure</a></li>
<li><a href="05-customization.html">Customization</a></li>
<li><a href="06-how-it-works.html">How it Works</a></li>
</ol>
</nav>
<nav class="small">
@ -60,6 +64,7 @@
<article>
<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, 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>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>
<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:#d3d0c8;">$ mkbook

@ -14,7 +14,7 @@
&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;
" />
<meta property="book:author" content="Kenton Hamaluik" />
<meta property="book:release_date" content="2019-11-28T18:22:59.188707583+00:00" />
<meta property="book:release_date" content="2019-11-28T19:18:47.381384897+00:00" />
</head>
<body>
<nav class="big">
@ -32,6 +32,10 @@
<li><a href="04-structure.html">Structure</a></li>
<li><a href="05-customization.html">Customization</a></li>
<li><a href="06-how-it-works.html">How it Works</a></li>
</ol>
</nav>
<nav class="small">
@ -100,6 +104,339 @@
</span></pre>
</li>
</ul>
<h2><a href="#syntax-highlight" aria-hidden="true" class="anchor" id="headersyntax-highlight"></a>Syntax Highlight</h2>
<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;">```</span><span style="color:#f99157;">c</span><span style="color:#d3d0c8;">++
</span><span style="color:#d3d0c8;">#include &lt;stdio&gt;
</span><span style="color:#d3d0c8;">
</span><span style="color:#d3d0c8;">int main() {
</span><span style="color:#d3d0c8;"> std::cout &lt;&lt; &quot;Hello, world!&quot; &lt;&lt; std::endl;
</span><span style="color:#d3d0c8;"> return 0;
</span><span style="color:#d3d0c8;">}
</span><span style="color:#d3d0c8;">```
</span></pre>
<p>which results in:</p>
<pre style="background-color:#2d2d2d;">
<span style="color:#cc99cc;">#include </span><span style="color:#d3d0c8;">&lt;</span><span style="color:#99cc99;">stdio</span><span style="color:#d3d0c8;">&gt;
</span><span style="color:#d3d0c8;">
</span><span style="color:#cc99cc;">int </span><span style="color:#6699cc;">main</span><span style="color:#d3d0c8;">() {
</span><span style="color:#d3d0c8;"> std::cout &lt;&lt; &quot;</span><span style="color:#99cc99;">Hello, world!</span><span style="color:#d3d0c8;">&quot; &lt;&lt; std::endl;
</span><span style="color:#d3d0c8;"> </span><span style="color:#cc99cc;">return </span><span style="color:#f99157;">0</span><span style="color:#d3d0c8;">;
</span><span style="color:#d3d0c8;">}
</span></pre>
<p>To denote the language you can either use one the languages extensions as the label, or the full name of the language (which is <strong>not</strong> case-sensitive).</p>
<p>The list of supported languages is currently as follows:</p>
<table>
<thead>
<tr>
<th align="left">Language Name</th>
<th align="left">Supported Tags / Extensions</th>
</tr>
</thead>
<tbody>
<tr>
<td align="left">ASP</td>
<td align="left"><code>asa</code></td>
</tr>
<tr>
<td align="left">ActionScript</td>
<td align="left"><code>as</code></td>
</tr>
<tr>
<td align="left">AppleScript</td>
<td align="left"><code>applescript</code>, <code>script editor</code></td>
</tr>
<tr>
<td align="left">Batch File</td>
<td align="left"><code>bat</code>, <code>cmd</code></td>
</tr>
<tr>
<td align="left">BibTeX</td>
<td align="left"><code>bib</code></td>
</tr>
<tr>
<td align="left">Bourne Again Shell (bash)</td>
<td align="left"><code>sh</code>, <code>bash</code>, <code>zsh</code>, <code>fish</code>, <code>.bash_aliases</code>, <code>.bash_completions</code>, <code>.bash_functions</code>, <code>.bash_login</code>, <code>.bash_logout</code>, <code>.bash_profile</code>, <code>.bash_variables</code>, <code>.bashrc</code>, <code>.profile</code>, <code>.textmate_init</code></td>
</tr>
<tr>
<td align="left">C</td>
<td align="left"><code>c</code>, <code>h</code></td>
</tr>
<tr>
<td align="left">C#</td>
<td align="left"><code>cs</code>, <code>csx</code></td>
</tr>
<tr>
<td align="left">C++</td>
<td align="left"><code>cpp</code>, <code>cc</code>, <code>cp</code>, <code>cxx</code>, <code>c++</code>, <code>C</code>, <code>h</code>, <code>hh</code>, <code>hpp</code>, <code>hxx</code>, <code>h++</code>, <code>inl</code>, <code>ipp</code></td>
</tr>
<tr>
<td align="left">CSS</td>
<td align="left"><code>css</code>, <code>css.erb</code>, <code>css.liquid</code></td>
</tr>
<tr>
<td align="left">Cargo Build Results</td>
<td align="left"></td>
</tr>
<tr>
<td align="left">Clojure</td>
<td align="left"><code>clj</code></td>
</tr>
<tr>
<td align="left">D</td>
<td align="left"><code>d</code>, <code>di</code></td>
</tr>
<tr>
<td align="left">Diff</td>
<td align="left"><code>diff</code>, <code>patch</code></td>
</tr>
<tr>
<td align="left">Erlang</td>
<td align="left"><code>erl</code>, <code>hrl</code>, <code>Emakefile</code>, <code>emakefile</code></td>
</tr>
<tr>
<td align="left">Go</td>
<td align="left"><code>go</code></td>
</tr>
<tr>
<td align="left">Graphviz (DOT)</td>
<td align="left"><code>dot</code>, <code>DOT</code>, <code>gv</code></td>
</tr>
<tr>
<td align="left">Groovy</td>
<td align="left"><code>groovy</code>, <code>gvy</code>, <code>gradle</code></td>
</tr>
<tr>
<td align="left">HTML (ASP)</td>
<td align="left"><code>asp</code></td>
</tr>
<tr>
<td align="left">HTML (Erlang)</td>
<td align="left"><code>yaws</code></td>
</tr>
<tr>
<td align="left">HTML (Rails)</td>
<td align="left"><code>rails</code>, <code>rhtml</code>, <code>erb</code>, <code>html.erb</code></td>
</tr>
<tr>
<td align="left">HTML (Tcl)</td>
<td align="left"><code>adp</code></td>
</tr>
<tr>
<td align="left">HTML</td>
<td align="left"><code>html</code>, <code>htm</code>, <code>shtml</code>, <code>xhtml</code>, <code>inc</code>, <code>tmpl</code>, <code>tpl</code></td>
</tr>
<tr>
<td align="left">Haskell</td>
<td align="left"><code>hs</code></td>
</tr>
<tr>
<td align="left">JSON</td>
<td align="left"><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></td>
</tr>
<tr>
<td align="left">Java Properties</td>
<td align="left"><code>properties</code></td>
</tr>
<tr>
<td align="left">Java Server Page (JSP)</td>
<td align="left"><code>jsp</code></td>
</tr>
<tr>
<td align="left">Java</td>
<td align="left"><code>java</code>, <code>bsh</code></td>
</tr>
<tr>
<td align="left">JavaDoc</td>
<td align="left"></td>
</tr>
<tr>
<td align="left">JavaScript (Rails)</td>
<td align="left"><code>js.erb</code></td>
</tr>
<tr>
<td align="left">JavaScript</td>
<td align="left"><code>js</code>, <code>htc</code></td>
</tr>
<tr>
<td align="left">LaTeX Log</td>
<td align="left"></td>
</tr>
<tr>
<td align="left">LaTeX</td>
<td align="left"><code>tex</code>, <code>ltx</code></td>
</tr>
<tr>
<td align="left">Lisp</td>
<td align="left"><code>lisp</code>, <code>cl</code>, <code>clisp</code>, <code>l</code>, <code>mud</code>, <code>el</code>, <code>scm</code>, <code>ss</code>, <code>lsp</code>, <code>fasl</code></td>
</tr>
<tr>
<td align="left">Literate Haskell</td>
<td align="left"><code>lhs</code></td>
</tr>
<tr>
<td align="left">Lua</td>
<td align="left"><code>lua</code></td>
</tr>
<tr>
<td align="left">MATLAB</td>
<td align="left"><code>matlab</code></td>
</tr>
<tr>
<td align="left">Make Output</td>
<td align="left"></td>
</tr>
<tr>
<td align="left">Makefile</td>
<td align="left"><code>make</code>, <code>GNUmakefile</code>, <code>makefile</code>, <code>Makefile</code>, <code>OCamlMakefile</code>, <code>mak</code>, <code>mk</code></td>
</tr>
<tr>
<td align="left">Markdown</td>
<td align="left"><code>md</code>, <code>mdown</code>, <code>markdown</code>, <code>markdn</code></td>
</tr>
<tr>
<td align="left">MultiMarkdown</td>
<td align="left"></td>
</tr>
<tr>
<td align="left">NAnt Build File</td>
<td align="left"><code>build</code></td>
</tr>
<tr>
<td align="left">OCaml</td>
<td align="left"><code>ml</code>, <code>mli</code></td>
</tr>
<tr>
<td align="left">OCamllex</td>
<td align="left"><code>mll</code></td>
</tr>
<tr>
<td align="left">OCamlyacc</td>
<td align="left"><code>mly</code></td>
</tr>
<tr>
<td align="left">Objective-C</td>
<td align="left"><code>m</code>, <code>h</code></td>
</tr>
<tr>
<td align="left">Objective-C++</td>
<td align="left"><code>mm</code>, <code>M</code>, <code>h</code></td>
</tr>
<tr>
<td align="left">PHP Source</td>
<td align="left"></td>
</tr>
<tr>
<td align="left">PHP</td>
<td align="left"><code>php</code>, <code>php3</code>, <code>php4</code>, <code>php5</code>, <code>php7</code>, <code>phps</code>, <code>phpt</code>, <code>phtml</code></td>
</tr>
<tr>
<td align="left">Pascal</td>
<td align="left"><code>pas</code>, <code>p</code>, <code>dpr</code></td>
</tr>
<tr>
<td align="left">Perl</td>
<td align="left"><code>pl</code>, <code>pm</code>, <code>pod</code>, <code>t</code>, <code>PL</code></td>
</tr>
<tr>
<td align="left">Plain Text</td>
<td align="left"><code>txt</code></td>
</tr>
<tr>
<td align="left">Python</td>
<td align="left"><code>py</code>, <code>py3</code>, <code>pyw</code>, <code>pyi</code>, <code>pyx</code>, <code>pyx.in</code>, <code>pxd</code>, <code>pxd.in</code>, <code>pxi</code>, <code>pxi.in</code>, <code>rpy</code>, <code>cpy</code>, <code>SConstruct</code>, <code>Sconstruct</code>, <code>sconstruct</code>, <code>SConscript</code>, <code>gyp</code>, <code>gypi</code>, <code>Snakefile</code>, <code>wscript</code></td>
</tr>
<tr>
<td align="left">R Console</td>
<td align="left"></td>
</tr>
<tr>
<td align="left">R</td>
<td align="left"><code>R</code>, <code>r</code>, <code>s</code>, <code>S</code>, <code>Rprofile</code></td>
</tr>
<tr>
<td align="left">Rd (R Documentation)</td>
<td align="left"><code>rd</code></td>
</tr>
<tr>
<td align="left">Regular Expression</td>
<td align="left"><code>re</code></td>
</tr>
<tr>
<td align="left">Regular Expressions (Javascript)</td>
<td align="left"></td>
</tr>
<tr>
<td align="left">Regular Expressions (Python)</td>
<td align="left"></td>
</tr>
<tr>
<td align="left">Ruby Haml</td>
<td align="left"><code>haml</code>, <code>sass</code></td>
</tr>
<tr>
<td align="left">Ruby on Rails</td>
<td align="left"><code>rxml</code>, <code>builder</code></td>
</tr>
<tr>
<td align="left">Ruby</td>
<td align="left"><code>rb</code>, <code>Appfile</code>, <code>Appraisals</code>, <code>Berksfile</code>, <code>Brewfile</code>, <code>capfile</code>, <code>cgi</code>, <code>Cheffile</code>, <code>config.ru</code>, <code>Deliverfile</code>, <code>Fastfile</code>, <code>fcgi</code>, <code>Gemfile</code>, <code>gemspec</code>, <code>Guardfile</code>, <code>irbrc</code>, <code>jbuilder</code>, <code>podspec</code>, <code>prawn</code>, <code>rabl</code>, <code>rake</code>, <code>Rakefile</code>, <code>Rantfile</code>, <code>rbx</code>, <code>rjs</code>, <code>ruby.rail</code>, <code>Scanfile</code>, <code>simplecov</code>, <code>Snapfile</code>, <code>thor</code>, <code>Thorfile</code>, <code>Vagrantfile</code></td>
</tr>
<tr>
<td align="left">Rust</td>
<td align="left"><code>rs</code></td>
</tr>
<tr>
<td align="left">SQL (Rails)</td>
<td align="left"><code>erbsql</code>, <code>sql.erb</code></td>
</tr>
<tr>
<td align="left">SQL</td>
<td align="left"><code>sql</code>, <code>ddl</code>, <code>dml</code></td>
</tr>
<tr>
<td align="left">Scala</td>
<td align="left"><code>scala</code>, <code>sbt</code></td>
</tr>
<tr>
<td align="left">Shell-Unix-Generic</td>
<td align="left"></td>
</tr>
<tr>
<td align="left">Tcl</td>
<td align="left"><code>tcl</code></td>
</tr>
<tr>
<td align="left">TeX</td>
<td align="left"><code>sty</code>, <code>cls</code></td>
</tr>
<tr>
<td align="left">Textile</td>
<td align="left"><code>textile</code></td>
</tr>
<tr>
<td align="left">XML</td>
<td align="left"><code>xml</code>, <code>xsd</code>, <code>xslt</code>, <code>tld</code>, <code>dtml</code>, <code>rss</code>, <code>opml</code>, <code>svg</code></td>
</tr>
<tr>
<td align="left">YAML</td>
<td align="left"><code>yaml</code>, <code>yml</code>, <code>sublime-syntax</code></td>
</tr>
<tr>
<td align="left">camlp4</td>
<td align="left"></td>
</tr>
<tr>
<td align="left">commands-builtin-shell-bash</td>
<td align="left"></td>
</tr>
<tr>
<td align="left">reStructuredText</td>
<td align="left"><code>rst</code>, <code>rest</code></td>
</tr>
</tbody>
</table>

@ -14,7 +14,7 @@
&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;
" />
<meta property="book:author" content="Kenton Hamaluik" />
<meta property="book:release_date" content="2019-11-28T18:22:59.188707583+00:00" />
<meta property="book:release_date" content="2019-11-28T19:18:47.381384897+00:00" />
</head>
<body>
<nav class="big">
@ -32,6 +32,10 @@
<li><a href="04-structure.html">Structure</a></li>
<li><a href="05-customization.html">Customization</a></li>
<li><a href="06-how-it-works.html">How it Works</a></li>
</ol>
</nav>
<nav class="small">

@ -14,7 +14,7 @@
&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;
" />
<meta property="book:author" content="Kenton Hamaluik" />
<meta property="book:release_date" content="2019-11-28T18:22:59.188707583+00:00" />
<meta property="book:release_date" content="2019-11-28T19:18:47.381384897+00:00" />
</head>
<body>
<nav class="big">
@ -32,6 +32,10 @@
<li><a href="04-structure.html" class = "current">Structure</a></li>
<li><a href="05-customization.html">Customization</a></li>
<li><a href="06-how-it-works.html">How it Works</a></li>
</ol>
</nav>
<nav class="small">
@ -48,11 +52,70 @@
<span class="title">Structure</span>
<span class="placeholder"></span>
<a href="05-customization.html" alt="Customization">
<span class="icon">
<svg class="icon-arrow-right">
<use xlink:href="icons.svg#icon-arrow-right">
</svg>
</span>
</a>
</nav>
<article>
<p><em>mkbook</em> currently only supports two types of assets to use in rendering: assets (images, etc), and documents (markdown files).</p>
<p><em>mkbook</em> follows a fairly simple directory structure for now, with a <code>mkbook.toml</code> file declaring the books metadata, and <code>.md</code> files defining each chapter of the book.</p>
<h2><a href="#mkbooktoml" aria-hidden="true" class="anchor" id="headermkbooktoml"></a><code>mkbook.toml</code></h2>
<p><em>mkbook</em> generally requires a <code>mkbook.toml</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>
<li>The books author (<code>author</code>)</li>
<li>The publication date (<code>pubdate</code>)</li>
<li>The canonical URL for the book (<code>url</code>)</li>
<li>A markdown-formatted description of the book (<code>description</code>)</li>
</ul>
<p>If the <code>mkbook.toml</code> file or any of the entries are missing, default values will be used.</p>
<h3><a href="#sample" aria-hidden="true" class="anchor" id="headersample"></a>Sample</h3>
<pre style="background-color:#2d2d2d;">
<span style="color:#d3d0c8;">title = &quot;The mkbook Book&quot;
</span><span style="color:#d3d0c8;">author = &quot;Kenton Hamaluik&quot;
</span><span style="color:#d3d0c8;">url = &quot;https://hamaluik.github.io/mkbook/&quot;
</span><span style="color:#d3d0c8;">description = &quot;&quot;&quot;
</span><span style="color:#d3d0c8;">_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.
</span><span style="color:#d3d0c8;">
</span><span style="color:#d3d0c8;">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.
</span><span style="color:#d3d0c8;">&quot;&quot;&quot;
</span></pre>
<h3><a href="#default-values" aria-hidden="true" class="anchor" id="headerdefault-values"></a>Default Values</h3>
<dl><dt>
<p><code>title</code></p>
</dt>
<dd>
<p>“My Cool Book”</p>
</dd>
<dt>
<p><code>author</code></p>
</dt>
<dd>
<p>“Anonymous”</p>
</dd>
<dt>
<p><code>pubdate</code></p>
</dt>
<dd>
<p>The date the book was built from the command line, in UTC time</p>
</dd>
<dt>
<p><code>url</code></p>
</dt>
<dd>
<p>“”</p>
</dd>
<dt>
<p><code>description</code></p>
</dt>
<dd>
<p>“”</p>
</dd>
</dl>
<h2><a href="#assets" aria-hidden="true" class="anchor" id="headerassets"></a>Assets</h2>
<pre style="background-color:#2d2d2d;">
<span style="color:#d3d0c8;">unimplemented!()
@ -61,6 +124,7 @@
<p>For now, <em>mkbook</em> only works on a flat list of markdown files, with the intent of each markdown file being its own chapter. Subdirectories and files that dont end in a <code>.md</code> extension are completely ignored. 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;">
<span style="color:#d3d0c8;">src/
</span><span style="color:#d3d0c8;">├── mkbook.toml
</span><span style="color:#d3d0c8;">├── 00-foreword.md
</span><span style="color:#d3d0c8;">├── 01-introduction.md
</span><span style="color:#d3d0c8;">├── 02-my-first-chapter.md
@ -70,6 +134,16 @@
<div class="next-chapter">
<a href="05-customization.html">
<span>Next chapter: “Customization”</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>

@ -0,0 +1,83 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>The mkbook Book | Customization</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//05-customization.html" />
<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;
&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;
" />
<meta property="book:author" content="Kenton Hamaluik" />
<meta property="book:release_date" content="2019-11-28T19:18:47.381384897+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-introduction.html">Introduction</a></li>
<li><a href="02-markdown.html">Markdown</a></li>
<li><a href="03-frontmatter.html">Front Matter</a></li>
<li><a href="04-structure.html">Structure</a></li>
<li><a href="05-customization.html" class = "current">Customization</a></li>
<li><a href="06-how-it-works.html">How it Works</a></li>
</ol>
</nav>
<nav class="small">
<a href="04-structure.html" alt="Structure">
<span class="icon">
<svg class="icon-arrow-left">
<use xlink:href="icons.svg#icon-arrow-left">
</svg>
</span>
</a>
<span class="title">Customization</span>
<a href="06-how-it-works.html" alt="How it Works">
<span class="icon">
<svg class="icon-arrow-right">
<use xlink:href="icons.svg#icon-arrow-right">
</svg>
</span>
</a>
</nav>
<article>
<p>There isnt any way to customize the templates nor the CSS yet, though I will investigate this if the need arises.</p>
<div class="next-chapter">
<a href="06-how-it-works.html">
<span>Next chapter: “How it Works”</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>

@ -0,0 +1,77 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>The mkbook Book | How it Works</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//06-how-it-works.html" />
<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;
&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;
" />
<meta property="book:author" content="Kenton Hamaluik" />
<meta property="book:release_date" content="2019-11-28T19:18:47.381384897+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-introduction.html">Introduction</a></li>
<li><a href="02-markdown.html">Markdown</a></li>
<li><a href="03-frontmatter.html">Front Matter</a></li>
<li><a href="04-structure.html">Structure</a></li>
<li><a href="05-customization.html">Customization</a></li>
<li><a href="06-how-it-works.html" class = "current">How it Works</a></li>
</ol>
</nav>
<nav class="small">
<a href="05-customization.html" alt="Customization">
<span class="icon">
<svg class="icon-arrow-left">
<use xlink:href="icons.svg#icon-arrow-left">
</svg>
</span>
</a>
<span class="title">How it Works</span>
<span class="placeholder"></span>
</nav>
<article>
<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> 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>
<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>
<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>
<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>
<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.</p>
<footer><p>&copy; 2019 Kenton Hamaluik</p></footer>
</article>
</body>
</html>

@ -14,13 +14,13 @@
&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;
" />
<meta property="book:author" content="Kenton Hamaluik" />
<meta property="book:release_date" content="2019-11-28T18:22:59.188707583+00:00" />
<meta property="book:release_date" content="2019-11-28T19:18:47.381384897+00:00" />
</head>
<body class="toc">
<header>
<h1>The mkbook Book</h1>
<h2>by Kenton Hamaluik</h2>
<time datetime="2019-11-28T18:22:59.188707583+00:00">Nov 28, 2019</time>
<time datetime="2019-11-28T19:18:47.381384897+00:00">Nov 28, 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>
@ -39,6 +39,10 @@
<li><a href="04-structure.html">Structure</a></li>
<li><a href="05-customization.html">Customization</a></li>
<li><a href="06-how-it-works.html">How it Works</a></li>
</ol>
</nav>
<footer><p>&copy; 2019 Kenton Hamaluik</p></footer>

File diff suppressed because one or more lines are too long

@ -12,7 +12,19 @@ pub const ASSET_FAVICON: &'static [u8] = include_bytes!(concat!(env!("CARGO_MANI
pub const ASSET_ICONS: &'static [u8] = include_bytes!(concat!(env!("CARGO_MANIFEST_DIR"), "/assets/icons.svg"));
lazy_static! {
static ref HIGHLIGHT_SYNTAX_SETS: SyntaxSet = SyntaxSet::load_defaults_newlines();
static ref HIGHLIGHT_SYNTAX_SETS: SyntaxSet = {
let ss = SyntaxSet::load_defaults_newlines();
//if cfg!(debug_assertions) {
// println!("| Language Name | Supported Tags / Extensions |");
// println!("|:-|:-|");
// for s in ss.syntaxes().iter() {
// println!("| {} | `{}` |", s.name, s.file_extensions.iter().map(|s| &**s).collect::<Vec<&str>>().join("`, `"));
// }
//}
ss
};
static ref HIGHLIGHT_THEME_SETS: ThemeSet = ThemeSet::load_defaults();
static ref HIGHLIGHT_THEME: &'static Theme = &HIGHLIGHT_THEME_SETS.themes["base16-eighties.dark"];
static ref COMRAK_OPTIONS: ComrakOptions = ComrakOptions {

@ -72,13 +72,14 @@ dl {
dt {
font-weight: 700;
margin: 0;
padding: 0.5em;
padding: 0 0.5em 0.25em;
border-right: 1px solid #dddddd;
text-align: right;
}
dd {
margin: 0;
padding: 0.5em;
padding: 0 0.5em 0.25em;
}
dt, dd {
@ -98,3 +99,17 @@ footer {
margin-right: 0.5em;
}
}
table {
margin: 0 auto;
border-collapse: collapse;
border-spacing: 0.5em;
th {
border-bottom: 1px solid #eee;
}
th, td {
vertical-align: top;
}
}

Loading…
Cancel
Save