refactored file placement on html, added assets on latex

master
Kenton Hamaluik 4 years ago
parent 39a3697f83
commit c8a477a4e4

@ -65,7 +65,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")
```
![chapter-six](../book-chapter-six-5834.jpg "Photo by Kaboompics.com from Pexels")
![chapter-six](book-chapter-six-5834.jpg "Photo by Kaboompics.com from Pexels")
# Documents

@ -4,70 +4,70 @@
<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" />
<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="og:url" content="https://hamaluik.github.io/mkbook//01-command-line.html" />
<meta property="book:author" content="Kenton Hamaluik" />
<meta property="book:release_date" content="2019-12-08T19:06:20.608129944+00:00" />
<meta property="book:release_date" content="2019-12-09T06:12:31.253923271+00:00" />
</head>
<body>
<nav class="big">
<header>
<h1><a href="../index.html">The mkbook Book</a></h1>
<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>
<a href="01-command-line.html" class = "current">Command-line Interface</a>
</li>
<li>
<a href="../02-markdown/index.html">Markdown</a>
<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/01-commonmark.html">CommonMark</a></li>
<li><a href="../02-markdown/02-syntax-highlighting.html">Syntax Highlighting</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/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/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/05-images.html">Images</a></li>
<li><a href="../02-markdown/06-tables.html">Tables</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>
<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>
<a href="03-frontmatter.html">Front Matter</a>
</li>
<li>
<a href="../04-structure/index.html">Structure</a>
<a href="04-structure.html">Structure</a>
</li>
<li>
<a href="../05-customization/index.html">Customization</a>
<a href="05-customization.html">Customization</a>
</li>
<li>
<a href="../06-how-it-works/index.html">How it Works</a>
<a href="06-how-it-works.html">How it Works</a>
</li>
@ -75,10 +75,10 @@
</nav>
<nav class="small">
<span>
<a href="../index.html" alt="Table of Contents">
<a href="index.html" alt="Table of Contents">
<span class="icon">
<svg class="icon-list-ol">
<use xlink:href="../icons.svg#icon-list-ol">
<use xlink:href="icons.svg#icon-list-ol">
</svg>
</span>
</a>
@ -92,10 +92,10 @@
<span class="placeholder"></span>
<a href="../02-markdown&#x2f;index.html" alt="Markdown">
<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">
<use xlink:href="icons.svg#icon-arrow-right">
</svg>
</span>
</a>
@ -103,6 +103,7 @@
</span>
</nav>
<article>
<h1 class="title">Command-line Interface</h1>
<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
@ -202,11 +203,11 @@
<div class="next-chapter">
<a href="../02-markdown&#x2f;index.html">
<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">
<use xlink:href="icons.svg#icon-arrow-right">
</svg>
</span>
</a>

@ -1,206 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>The mkbook Book | Introduction</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-introduction/index.html" />
<meta property="book:author" content="Kenton Hamaluik" />
<meta property="book:release_date" content="2019-12-07T07:42:08.637368460+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/index.html" class = "current">Introduction</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">Introduction</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>
<h1><a href="#introduction" aria-hidden="true" class="anchor" id="headerintroduction"></a>Introduction</h1>
<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>
<h2><a href="#command-line-interface" aria-hidden="true" class="anchor" id="headercommand-line-interface"></a>Command-line Interface</h2>
<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>
<h3><a href="#the-init-command" aria-hidden="true" class="anchor" id="headerthe-init-command"></a>The Init Command</h3>
<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>
<h3><a href="#the-build-command" aria-hidden="true" class="anchor" id="headerthe-build-command"></a>The Build Command</h3>
<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>
<h3><a href="#the-watch-command" aria-hidden="true" class="anchor" id="headerthe-watch-command"></a>The Watch Command</h3>
<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>
<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-08T19:06:20.608129944+00:00" />
<meta property="book:release_date" content="2019-12-09T06:12:31.253923271+00:00" />
</head>
<body>
@ -24,7 +24,7 @@
<ol>
<li>
<a href="../01-command-line/index.html">Command-line Interface</a>
<a href="../01-command-line.html">Command-line Interface</a>
</li>
@ -52,22 +52,22 @@
</li>
<li>
<a href="../03-frontmatter/index.html">Front Matter</a>
<a href="../03-frontmatter.html">Front Matter</a>
</li>
<li>
<a href="../04-structure/index.html">Structure</a>
<a href="../04-structure.html">Structure</a>
</li>
<li>
<a href="../05-customization/index.html">Customization</a>
<a href="../05-customization.html">Customization</a>
</li>
<li>
<a href="../06-how-it-works/index.html">How it Works</a>
<a href="../06-how-it-works.html">How it Works</a>
</li>
@ -111,6 +111,7 @@
</span>
</nav>
<article>
<h1 class="title">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>
<pre style="background-color:#2d2d2d;">
<span style="color:#cc99cc;">let</span><span style="color:#d3d0c8;"> options: ComrakOptions = ComrakOptions {

@ -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-08T19:06:20.608129944+00:00" />
<meta property="book:release_date" content="2019-12-09T06:12:31.253923271+00:00" />
</head>
<body>
@ -24,7 +24,7 @@
<ol>
<li>
<a href="../01-command-line/index.html">Command-line Interface</a>
<a href="../01-command-line.html">Command-line Interface</a>
</li>
@ -52,22 +52,22 @@
</li>
<li>
<a href="../03-frontmatter/index.html">Front Matter</a>
<a href="../03-frontmatter.html">Front Matter</a>
</li>
<li>
<a href="../04-structure/index.html">Structure</a>
<a href="../04-structure.html">Structure</a>
</li>
<li>
<a href="../05-customization/index.html">Customization</a>
<a href="../05-customization.html">Customization</a>
</li>
<li>
<a href="../06-how-it-works/index.html">How it Works</a>
<a href="../06-how-it-works.html">How it Works</a>
</li>
@ -111,6 +111,7 @@
</span>
</nav>
<article>
<h1 class="title">Syntax Highlighting</h1>
<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++

@ -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-08T19:06:20.608129944+00:00" />
<meta property="book:release_date" content="2019-12-09T06:12:31.253923271+00:00" />
</head>
<body>
@ -24,7 +24,7 @@
<ol>
<li>
<a href="../01-command-line/index.html">Command-line Interface</a>
<a href="../01-command-line.html">Command-line Interface</a>
</li>
@ -52,22 +52,22 @@
</li>
<li>
<a href="../03-frontmatter/index.html">Front Matter</a>
<a href="../03-frontmatter.html">Front Matter</a>
</li>
<li>
<a href="../04-structure/index.html">Structure</a>
<a href="../04-structure.html">Structure</a>
</li>
<li>
<a href="../05-customization/index.html">Customization</a>
<a href="../05-customization.html">Customization</a>
</li>
<li>
<a href="../06-how-it-works/index.html">How it Works</a>
<a href="../06-how-it-works.html">How it Works</a>
</li>
@ -111,6 +111,7 @@
</span>
</nav>
<article>
<h1 class="title">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>For example:</p>
<pre style="background-color:#2d2d2d;">

@ -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-08T19:06:20.608129944+00:00" />
<meta property="book:release_date" content="2019-12-09T06:12:31.253923271+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-command-line/index.html">Command-line Interface</a>
<a href="../01-command-line.html">Command-line Interface</a>
</li>
@ -52,22 +52,22 @@
</li>
<li>
<a href="../03-frontmatter/index.html">Front Matter</a>
<a href="../03-frontmatter.html">Front Matter</a>
</li>
<li>
<a href="../04-structure/index.html">Structure</a>
<a href="../04-structure.html">Structure</a>
</li>
<li>
<a href="../05-customization/index.html">Customization</a>
<a href="../05-customization.html">Customization</a>
</li>
<li>
<a href="../06-how-it-works/index.html">How it Works</a>
<a href="../06-how-it-works.html">How it Works</a>
</li>
@ -111,6 +111,7 @@
</span>
</nav>
<article>
<h1 class="title">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>For example:</p>
<pre style="background-color:#2d2d2d;">

@ -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-08T19:06:20.608129944+00:00" />
<meta property="book:release_date" content="2019-12-09T06:12:31.253923271+00:00" />
</head>
<body>
@ -24,7 +24,7 @@
<ol>
<li>
<a href="../01-command-line/index.html">Command-line Interface</a>
<a href="../01-command-line.html">Command-line Interface</a>
</li>
@ -52,22 +52,22 @@
</li>
<li>
<a href="../03-frontmatter/index.html">Front Matter</a>
<a href="../03-frontmatter.html">Front Matter</a>
</li>
<li>
<a href="../04-structure/index.html">Structure</a>
<a href="../04-structure.html">Structure</a>
</li>
<li>
<a href="../05-customization/index.html">Customization</a>
<a href="../05-customization.html">Customization</a>
</li>
<li>
<a href="../06-how-it-works/index.html">How it Works</a>
<a href="../06-how-it-works.html">How it Works</a>
</li>
@ -111,6 +111,7 @@
</span>
</nav>
<article>
<h1 class="title">Images</h1>
<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;">)

@ -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-08T19:06:20.608129944+00:00" />
<meta property="book:release_date" content="2019-12-09T06:12:31.253923271+00:00" />
</head>
<body>
@ -24,7 +24,7 @@
<ol>
<li>
<a href="../01-command-line/index.html">Command-line Interface</a>
<a href="../01-command-line.html">Command-line Interface</a>
</li>
@ -52,22 +52,22 @@
</li>
<li>
<a href="../03-frontmatter/index.html">Front Matter</a>
<a href="../03-frontmatter.html">Front Matter</a>
</li>
<li>
<a href="../04-structure/index.html">Structure</a>
<a href="../04-structure.html">Structure</a>
</li>
<li>
<a href="../05-customization/index.html">Customization</a>
<a href="../05-customization.html">Customization</a>
</li>
<li>
<a href="../06-how-it-works/index.html">How it Works</a>
<a href="../06-how-it-works.html">How it Works</a>
</li>
@ -111,6 +111,7 @@
</span>
</nav>
<article>
<h1 class="title">Tables</h1>
<p>Tables are created using the <a href="https://github.github.com/gfm/#tables-extension-">pipe syntax</a>, for example the following:</p>
<pre style="background-color:#2d2d2d;">
<span style="color:#d3d0c8;">| Tables | Are | Cool |

@ -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-08T19:06:20.608129944+00:00" />
<meta property="book:release_date" content="2019-12-09T06:12:31.253923271+00:00" />
</head>
<body>
@ -24,7 +24,7 @@
<ol>
<li>
<a href="../01-command-line/index.html">Command-line Interface</a>
<a href="../01-command-line.html">Command-line Interface</a>
</li>
@ -52,22 +52,22 @@
</li>
<li>
<a href="../03-frontmatter/index.html">Front Matter</a>
<a href="../03-frontmatter.html">Front Matter</a>
</li>
<li>
<a href="../04-structure/index.html">Structure</a>
<a href="../04-structure.html">Structure</a>
</li>
<li>
<a href="../05-customization/index.html">Customization</a>
<a href="../05-customization.html">Customization</a>
</li>
<li>
<a href="../06-how-it-works/index.html">How it Works</a>
<a href="../06-how-it-works.html">How it Works</a>
</li>
@ -100,7 +100,7 @@
<span class="placeholder"></span>
<a href="../03-frontmatter&#x2f;index.html" alt="Front Matter">
<a href="../03-frontmatter.html" alt="Front Matter">
<span class="icon">
<svg class="icon-arrow-right">
<use xlink:href="../icons.svg#icon-arrow-right">
@ -111,6 +111,7 @@
</span>
</nav>
<article>
<h1 class="title">Task Lists</h1>
<p>You can also use <a href="https://help.github.com/en/github/writing-on-github">GFM</a>-style <a href="https://github.blog/2013-01-09-task-lists-in-gfm-issues-pulls-comments/">task lists</a> to indicate a TODO list:</p>
<ul>
<li><input type="checkbox" disabled="" /> a task list item</li>
@ -123,7 +124,7 @@
<div class="next-chapter">
<a href="../03-frontmatter&#x2f;index.html">
<a href="../03-frontmatter.html">
<span>Next chapter: “Front Matter”</span>
<span class="icon">
<svg class="icon-arrow-right">

@ -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-08T19:06:20.608129944+00:00" />
<meta property="book:release_date" content="2019-12-09T06:12:31.253923271+00:00" />
</head>
<body>
@ -24,7 +24,7 @@
<ol>
<li>
<a href="../01-command-line/index.html">Command-line Interface</a>
<a href="../01-command-line.html">Command-line Interface</a>
</li>
@ -52,22 +52,22 @@
</li>
<li>
<a href="../03-frontmatter/index.html">Front Matter</a>
<a href="../03-frontmatter.html">Front Matter</a>
</li>
<li>
<a href="../04-structure/index.html">Structure</a>
<a href="../04-structure.html">Structure</a>
</li>
<li>
<a href="../05-customization/index.html">Customization</a>
<a href="../05-customization.html">Customization</a>
</li>
<li>
<a href="../06-how-it-works/index.html">How it Works</a>
<a href="../06-how-it-works.html">How it Works</a>
</li>
@ -84,7 +84,7 @@
</a>
<a href="../01-command-line&#x2f;index.html" alt="Command-line Interface">
<a href="../01-command-line.html" alt="Command-line Interface">
<span class="icon">
<svg class="icon-arrow-up">
@ -111,6 +111,7 @@
</span>
</nav>
<article>
<h1 class="title">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>The above paragraph looks like this:</p>
<pre style="background-color:#2d2d2d;">

@ -4,70 +4,70 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>The mkbook Book | Front Matter</title>
<link rel="stylesheet" href="../style.css" type="text/css" media="all" />
<link rel="shortcut icon" href="../favicon.ico" />
<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//03-frontmatter/index.html" />
<meta property="og:url" content="https://hamaluik.github.io/mkbook//03-frontmatter.html" />
<meta property="book:author" content="Kenton Hamaluik" />
<meta property="book:release_date" content="2019-12-08T19:06:20.608129944+00:00" />
<meta property="book:release_date" content="2019-12-09T06:12:31.253923271+00:00" />
</head>
<body>
<nav class="big">
<header>
<h1><a href="../index.html">The mkbook Book</a></h1>
<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">Command-line Interface</a>
<a href="01-command-line.html">Command-line Interface</a>
</li>
<li>
<a href="../02-markdown/index.html">Markdown</a>
<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/01-commonmark.html">CommonMark</a></li>
<li><a href="../02-markdown/02-syntax-highlighting.html">Syntax Highlighting</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/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/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/05-images.html">Images</a></li>
<li><a href="../02-markdown/06-tables.html">Tables</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>
<li><a href="02-markdown/07-task-lists.html">Task Lists</a></li>
</ol>
</li>
<li>
<a href="../03-frontmatter/index.html" class = "current">Front Matter</a>
<a href="03-frontmatter.html" class = "current">Front Matter</a>
</li>
<li>
<a href="../04-structure/index.html">Structure</a>
<a href="04-structure.html">Structure</a>
</li>
<li>
<a href="../05-customization/index.html">Customization</a>
<a href="05-customization.html">Customization</a>
</li>
<li>
<a href="../06-how-it-works/index.html">How it Works</a>
<a href="06-how-it-works.html">How it Works</a>
</li>
@ -75,20 +75,20 @@
</nav>
<nav class="small">
<span>
<a href="../index.html" alt="Table of Contents">
<a href="index.html" alt="Table of Contents">
<span class="icon">
<svg class="icon-list-ol">
<use xlink:href="../icons.svg#icon-list-ol">
<use xlink:href="icons.svg#icon-list-ol">
</svg>
</span>
</a>
<a href="../02-markdown&#x2f;07-task-lists.html" alt="Task Lists">
<a href="02-markdown&#x2f;07-task-lists.html" alt="Task Lists">
<span class="icon">
<svg class="icon-arrow-left">
<use xlink:href="../icons.svg#icon-arrow-left">
<use xlink:href="icons.svg#icon-arrow-left">
</svg>
</span>
@ -100,10 +100,10 @@
<span class="placeholder"></span>
<a href="../04-structure&#x2f;index.html" alt="Structure">
<a href="04-structure.html" alt="Structure">
<span class="icon">
<svg class="icon-arrow-right">
<use xlink:href="../icons.svg#icon-arrow-right">
<use xlink:href="icons.svg#icon-arrow-right">
</svg>
</span>
</a>
@ -111,6 +111,7 @@
</span>
</nav>
<article>
<h1 class="title">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>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;">
@ -153,11 +154,11 @@
<div class="next-chapter">
<a href="../04-structure&#x2f;index.html">
<a href="04-structure.html">
<span>Next chapter: “Structure”</span>
<span class="icon">
<svg class="icon-arrow-right">
<use xlink:href="../icons.svg#icon-arrow-right">
<use xlink:href="icons.svg#icon-arrow-right">
</svg>
</span>
</a>

@ -4,70 +4,70 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>The mkbook Book | Structure</title>
<link rel="stylesheet" href="../style.css" type="text/css" media="all" />
<link rel="shortcut icon" href="../favicon.ico" />
<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//04-structure/index.html" />
<meta property="og:url" content="https://hamaluik.github.io/mkbook//04-structure.html" />
<meta property="book:author" content="Kenton Hamaluik" />
<meta property="book:release_date" content="2019-12-08T19:06:20.608129944+00:00" />
<meta property="book:release_date" content="2019-12-09T06:12:31.253923271+00:00" />
</head>
<body>
<nav class="big">
<header>
<h1><a href="../index.html">The mkbook Book</a></h1>
<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">Command-line Interface</a>
<a href="01-command-line.html">Command-line Interface</a>
</li>
<li>
<a href="../02-markdown/index.html">Markdown</a>
<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/01-commonmark.html">CommonMark</a></li>
<li><a href="../02-markdown/02-syntax-highlighting.html">Syntax Highlighting</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/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/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/05-images.html">Images</a></li>
<li><a href="../02-markdown/06-tables.html">Tables</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>
<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>
<a href="03-frontmatter.html">Front Matter</a>
</li>
<li>
<a href="../04-structure/index.html" class = "current">Structure</a>
<a href="04-structure.html" class = "current">Structure</a>
</li>
<li>
<a href="../05-customization/index.html">Customization</a>
<a href="05-customization.html">Customization</a>
</li>
<li>
<a href="../06-how-it-works/index.html">How it Works</a>
<a href="06-how-it-works.html">How it Works</a>
</li>
@ -75,20 +75,20 @@
</nav>
<nav class="small">
<span>
<a href="../index.html" alt="Table of Contents">
<a href="index.html" alt="Table of Contents">
<span class="icon">
<svg class="icon-list-ol">
<use xlink:href="../icons.svg#icon-list-ol">
<use xlink:href="icons.svg#icon-list-ol">
</svg>
</span>
</a>
<a href="../03-frontmatter&#x2f;index.html" alt="Front Matter">
<a href="03-frontmatter.html" alt="Front Matter">
<span class="icon">
<svg class="icon-arrow-left">
<use xlink:href="../icons.svg#icon-arrow-left">
<use xlink:href="icons.svg#icon-arrow-left">
</svg>
</span>
@ -100,10 +100,10 @@
<span class="placeholder"></span>
<a href="../05-customization&#x2f;index.html" alt="Customization">
<a href="05-customization.html" alt="Customization">
<span class="icon">
<svg class="icon-arrow-right">
<use xlink:href="../icons.svg#icon-arrow-right">
<use xlink:href="icons.svg#icon-arrow-right">
</svg>
</span>
</a>
@ -111,6 +111,7 @@
</span>
</nav>
<article>
<h1 class="title">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>
<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>
@ -176,7 +177,7 @@
<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>
<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>
<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>
@ -197,11 +198,11 @@
<div class="next-chapter">
<a href="../05-customization&#x2f;index.html">
<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">
<use xlink:href="icons.svg#icon-arrow-right">
</svg>
</span>
</a>

@ -4,70 +4,70 @@
<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" />
<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/index.html" />
<meta property="og:url" content="https://hamaluik.github.io/mkbook//05-customization.html" />
<meta property="book:author" content="Kenton Hamaluik" />
<meta property="book:release_date" content="2019-12-08T19:06:20.608129944+00:00" />
<meta property="book:release_date" content="2019-12-09T06:12:31.253923271+00:00" />
</head>
<body>
<nav class="big">
<header>
<h1><a href="../index.html">The mkbook Book</a></h1>
<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">Command-line Interface</a>
<a href="01-command-line.html">Command-line Interface</a>
</li>
<li>
<a href="../02-markdown/index.html">Markdown</a>
<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/01-commonmark.html">CommonMark</a></li>
<li><a href="../02-markdown/02-syntax-highlighting.html">Syntax Highlighting</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/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/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/05-images.html">Images</a></li>
<li><a href="../02-markdown/06-tables.html">Tables</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>
<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>
<a href="03-frontmatter.html">Front Matter</a>
</li>
<li>
<a href="../04-structure/index.html">Structure</a>
<a href="04-structure.html">Structure</a>
</li>
<li>
<a href="../05-customization/index.html" class = "current">Customization</a>
<a href="05-customization.html" class = "current">Customization</a>
</li>
<li>
<a href="../06-how-it-works/index.html">How it Works</a>
<a href="06-how-it-works.html">How it Works</a>
</li>
@ -75,20 +75,20 @@
</nav>
<nav class="small">
<span>
<a href="../index.html" alt="Table of Contents">
<a href="index.html" alt="Table of Contents">
<span class="icon">
<svg class="icon-list-ol">
<use xlink:href="../icons.svg#icon-list-ol">
<use xlink:href="icons.svg#icon-list-ol">
</svg>
</span>
</a>
<a href="../04-structure&#x2f;index.html" alt="Structure">
<a href="04-structure.html" alt="Structure">
<span class="icon">
<svg class="icon-arrow-left">
<use xlink:href="../icons.svg#icon-arrow-left">
<use xlink:href="icons.svg#icon-arrow-left">
</svg>
</span>
@ -100,10 +100,10 @@
<span class="placeholder"></span>
<a href="../06-how-it-works&#x2f;index.html" alt="How it Works">
<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">
<use xlink:href="icons.svg#icon-arrow-right">
</svg>
</span>
</a>
@ -111,16 +111,17 @@
</span>
</nav>
<article>
<h1 class="title">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>
<div class="next-chapter">
<a href="../06-how-it-works&#x2f;index.html">
<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">
<use xlink:href="icons.svg#icon-arrow-right">
</svg>
</span>
</a>

@ -4,70 +4,70 @@
<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" />
<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/index.html" />
<meta property="og:url" content="https://hamaluik.github.io/mkbook//06-how-it-works.html" />
<meta property="book:author" content="Kenton Hamaluik" />
<meta property="book:release_date" content="2019-12-08T19:06:20.608129944+00:00" />
<meta property="book:release_date" content="2019-12-09T06:12:31.253923271+00:00" />
</head>
<body>
<nav class="big">
<header>
<h1><a href="../index.html">The mkbook Book</a></h1>
<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">Command-line Interface</a>
<a href="01-command-line.html">Command-line Interface</a>
</li>
<li>
<a href="../02-markdown/index.html">Markdown</a>
<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/01-commonmark.html">CommonMark</a></li>
<li><a href="../02-markdown/02-syntax-highlighting.html">Syntax Highlighting</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/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/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/05-images.html">Images</a></li>
<li><a href="../02-markdown/06-tables.html">Tables</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>
<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>
<a href="03-frontmatter.html">Front Matter</a>
</li>
<li>
<a href="../04-structure/index.html">Structure</a>
<a href="04-structure.html">Structure</a>
</li>
<li>
<a href="../05-customization/index.html">Customization</a>
<a href="05-customization.html">Customization</a>
</li>
<li>
<a href="../06-how-it-works/index.html" class = "current">How it Works</a>
<a href="06-how-it-works.html" class = "current">How it Works</a>
</li>
@ -75,20 +75,20 @@
</nav>
<nav class="small">
<span>
<a href="../index.html" alt="Table of Contents">
<a href="index.html" alt="Table of Contents">
<span class="icon">
<svg class="icon-list-ol">
<use xlink:href="../icons.svg#icon-list-ol">
<use xlink:href="icons.svg#icon-list-ol">
</svg>
</span>
</a>
<a href="../05-customization&#x2f;index.html" alt="Customization">
<a href="05-customization.html" alt="Customization">
<span class="icon">
<svg class="icon-arrow-left">
<use xlink:href="../icons.svg#icon-arrow-left">
<use xlink:href="icons.svg#icon-arrow-left">
</svg>
</span>
@ -105,6 +105,7 @@
</span>
</nav>
<article>
<h1 class="title">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>
<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>

@ -15,14 +15,14 @@
&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-08T19:06:20.608129944+00:00" />
<meta property="book:release_date" content="2019-12-09T06:12:31.253923271+00:00" />
</head>
<body class="toc">
<header>
<h1>The mkbook Book</h1>
<h2>by Kenton Hamaluik</h2>
<time datetime="2019-12-08T19:06:20.608129944+00:00">Dec 8, 2019</time>
<time datetime="2019-12-09T06:12:31.253923271+00:00">Dec 9, 2019</time>
</header>
<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, 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>
@ -35,7 +35,7 @@
<ol>
<li>
<a href="01-command-line/index.html">Command-line Interface</a>
<a href="01-command-line.html">Command-line Interface</a>
</li>
@ -63,22 +63,22 @@
</li>
<li>
<a href="03-frontmatter/index.html">Front Matter</a>
<a href="03-frontmatter.html">Front Matter</a>
</li>
<li>
<a href="04-structure/index.html">Structure</a>
<a href="04-structure.html">Structure</a>
</li>
<li>
<a href="05-customization/index.html">Customization</a>
<a href="05-customization.html">Customization</a>
</li>
<li>
<a href="06-how-it-works/index.html">How it Works</a>
<a href="06-how-it-works.html">How it Works</a>
</li>

File diff suppressed because one or more lines are too long

@ -231,7 +231,7 @@ fn generate_index<W: io::Write>(book: &FrontMatter, content: String, include_kat
#[derive(Template)]
#[template(path = "page.html")]
struct PageTemplate<'a, 'b, 'c, 'd, 'e, 'g> {
struct PageTemplate<'a, 'b, 'c, 'd, 'e, 'g, 'f> {
chapter: &'a Chapter,
content: &'b str,
chapters: &'c Vec<Chapter>,
@ -240,9 +240,10 @@ struct PageTemplate<'a, 'b, 'c, 'd, 'e, 'g> {
book: &'g FrontMatter,
include_katex_css: bool,
include_reload_script: bool,
root_offset: &'f str,
}
fn format_page<W: io::Write>(book: &FrontMatter, chapter: &Chapter, chapters: &Vec<Chapter>, prev_chapter: Option<&Chapter>, next_chapter: Option<&Chapter>, content: &str, include_katex_css: bool, mut output: W, include_reload_script: bool) -> Result<(), Box<dyn std::error::Error>> {
fn format_page<W: io::Write>(book: &FrontMatter, chapter: &Chapter, offset_root: bool, chapters: &Vec<Chapter>, prev_chapter: Option<&Chapter>, next_chapter: Option<&Chapter>, content: &str, include_katex_css: bool, mut output: W, include_reload_script: bool) -> Result<(), Box<dyn std::error::Error>> {
// fill out our template
let template = PageTemplate {
chapter,
@ -253,6 +254,7 @@ fn format_page<W: io::Write>(book: &FrontMatter, chapter: &Chapter, chapters: &V
book,
include_katex_css,
include_reload_script,
root_offset: if offset_root { "../" } else { "" },
};
// and render!
@ -286,9 +288,17 @@ pub fn build<PIn: AsRef<Path>, POut: AsRef<Path>>(src: PIn, dest: POut, include_
for (chapter_index, chapter) in book.chapters.iter().enumerate() {
// render the index
let chapter_root = dest.join(chapter.source.file_stem().map(std::ffi::OsStr::to_str).flatten().unwrap());
let out = chapter_root.join("index.html");
log::info!("Rendering `{}` into `{}`...", chapter.source.display(), out.display());
fs::create_dir_all(&chapter_root)?;
let out = if chapter.sections.len() > 0 {
let out = chapter_root.join("index.html");
log::info!("Rendering `{}` into `{}`...", chapter.source.display(), out.display());
fs::create_dir_all(&chapter_root)?;
out
}
else {
let out = dest.join(format!("{}.html", chapter.source.file_stem().map(std::ffi::OsStr::to_str).flatten().unwrap()));
log::info!("Rendering `{}` into `{}`...", chapter.source.display(), out.display());
out
};
let outfile = fs::File::create(&out)?;
let outfile = io::BufWriter::new(outfile);
@ -306,7 +316,7 @@ pub fn build<PIn: AsRef<Path>, POut: AsRef<Path>>(src: PIn, dest: POut, include_
None
};
format_page(&book.front, &chapter, &book.chapters, prev_chapter, next_chapter, &output, include_katex_css, outfile, include_reload_script)?;
format_page(&book.front, &chapter, chapter.sections.len() > 0, &book.chapters, prev_chapter, next_chapter, &output, include_katex_css, outfile, include_reload_script)?;
prev_chapter = Some(chapter);
// now the sections
@ -330,7 +340,7 @@ pub fn build<PIn: AsRef<Path>, POut: AsRef<Path>>(src: PIn, dest: POut, include_
None
};
format_page(&book.front, &section, &book.chapters, prev_chapter, next_chapter, &output, include_katex_css, outfile, include_reload_script)?;
format_page(&book.front, &section, true, &book.chapters, prev_chapter, next_chapter, &output, include_katex_css, outfile, include_reload_script)?;
prev_chapter = Some(section);
}

@ -298,7 +298,25 @@ fn format_node<'a>(section_offset: u32, node: &'a comrak::nodes::AstNode<'a>, ou
output.push_str("}}");
},
NodeValue::Image(node_link) => {
// TODO: download images?
let url = std::str::from_utf8(&node_link.url).expect("valid utf-8");
if url.starts_with("http://") || url.starts_with("https://") {
// TODO: download images?
log::warn!("skipping image `{}` as we can't download images yet!", url);
}
else {
// TODO: make sure the file exists?
let title = std::str::from_utf8(&node_link.title).expect("valid utf-8");
output.push_str("\\begin{figure}[h]\n");
output.push_str("\\centering\n");
output.push_str("\\includegraphics[width=\\maxwidth{\\textwidth}]{");
output.push_str(url);
output.push_str("}\n");
output.push_str("\\caption{");
output.push_str(title);
output.push_str("}\n");
output.push_str("\\end{figure}\n");
}
},
NodeValue::FootnoteReference(label) => {
let label = std::str::from_utf8(&label).expect("valid utf-8");
@ -332,6 +350,7 @@ pub fn build<PIn: AsRef<Path>, POut: AsRef<Path>>(src: PIn, dest: POut) -> Resul
log::info!("created directory `{}`...", parent.display());
}
}
let dest_path = dest.parent().unwrap_or(Path::new(".")).to_owned();
// load the book
let mut book = super::load_book(&src)?;
@ -354,5 +373,29 @@ pub fn build<PIn: AsRef<Path>, POut: AsRef<Path>>(src: PIn, dest: POut) -> Resul
let rendered = latexbook.render()?;
fs::write(dest, rendered)?;
// copy the assets
for entry in ignore::Walk::new(&src) {
let entry = entry?;
if let Some(t) = entry.file_type() {
if t.is_file() {
if let Some("md") = entry.path().extension().map(std::ffi::OsStr::to_str).flatten() {
// ignore markdown files
}
else {
// we found an asset to copy!
let dest_path: PathBuf = dest_path.join(entry.path().iter().skip(1).map(PathBuf::from).collect::<PathBuf>());
if let Some(parent) = dest_path.parent() {
if !parent.exists() {
fs::create_dir_all(parent)?;
log::info!("created directory `{}`...", parent.display());
}
}
fs::copy(entry.path(), &dest_path)?;
log::info!("Copied `{}` to `{}`...", entry.path().display(), dest_path.display());
}
}
}
}
Ok(())
}

@ -129,7 +129,7 @@ fn load_book<P: AsRef<Path>>(src: P) -> Result<Book, Box<dyn std::error::Error>>
let contents = fs::read_to_string(&path)?;
let (front, contents) = extract_frontmatter(&contents)?;
let front = front.unwrap_or_default().into_front(&book_front, name, &format!("{}/index.html", name));
let front = front.unwrap_or_default().into_front(&book_front, name, &format!("{}.html", name));
chapters.push(Chapter {
front,
sections: Vec::new(),

@ -152,6 +152,10 @@ body {
>* {
max-width: 100%;
}
h1.title {
font-size: 2rem;
}
}
.next-chapter {
@ -204,6 +208,10 @@ body {
article {
padding: 1rem 0.5rem 0 0.5rem;
max-width: 100%;
h1.title {
display: none;
}
}
}
}

@ -41,6 +41,15 @@
% better lists
\usepackage{enumitem}
% better copyright symbol
\usepackage{textcomp}
% images
\usepackage{graphicx}
\makeatletter
\def\maxwidth#1{\ifdim\Gin@nat@width>#1 #1\else\Gin@nat@width\fi}
\makeatother
\title{ {{ front.title }} }
\author{ {{ front.author }} }
\date{ {{ front.pubdate|human_date }} }
@ -56,7 +65,7 @@
\topskip0pt
\vspace*{\fill}
\begin{center}
\textcopyright{} {{ front.pubdate|year }} {{ front.author }}
\textcopyright {{ front.pubdate|year }} {{ front.author }}
\end{center}
\vspace*{\fill}

@ -4,8 +4,8 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{{ book.title }} | {{ chapter.front.title }}</title>
<link rel="stylesheet" href="../style.css" type="text/css" media="all" />
<link rel="shortcut icon" href="../favicon.ico" />
<link rel="stylesheet" href="{{ root_offset|safe }}style.css" type="text/css" media="all" />
<link rel="shortcut icon" href="{{ root_offset|safe }}favicon.ico" />
<meta property="og:title" content="{{ book.title }}" />
<meta property="og:site_name" content="{{ book.title }}" />
<meta property="og:type" content="book" />
@ -18,17 +18,17 @@
<body>
<nav class="big">
<header>
<h1><a href="../index.html">{{ book.title }}</a></h1>
<h1><a href="{{ root_offset|safe }}index.html">{{ book.title }}</a></h1>
<h2>by {{ book.author }}</h2>
</header>
<ol>
{% for chap in chapters %}
<li>
<a href="../{{ chap.front.url|safe }}"{% if chapter.front.url == chap.front.url %} class = "current"{% endif %}>{{ chap.front.title }}</a>
<a href="{{ root_offset|safe }}{{ chap.front.url|safe }}"{% if chapter.front.url == chap.front.url %} class = "current"{% endif %}>{{ chap.front.title }}</a>
{% if chap.sections.len() > 0 %}
<ol>
{% for section in chap.sections %}
<li><a href="../{{ section.front.url|safe }}"{% if chapter.front.url == section.front.url %} class = "current"{% endif %}>{{ section.front.title }}</a></li>
<li><a href="{{ root_offset|safe }}{{ section.front.url|safe }}"{% if chapter.front.url == section.front.url %} class = "current"{% endif %}>{{ section.front.title }}</a></li>
{% endfor %}
</ol>
{% endif %}
@ -38,24 +38,24 @@
</nav>
<nav class="small">
<span>
<a href="../index.html" alt="Table of Contents">
<a href="{{ root_offset|safe }}index.html" alt="Table of Contents">
<span class="icon">
<svg class="icon-list-ol">
<use xlink:href="../icons.svg#icon-list-ol">
<use xlink:href="{{ root_offset|safe }}icons.svg#icon-list-ol">
</svg>
</span>
</a>
{% match prev_chapter %}
{% when Some with (chap) %}
<a href="../{{ chap.front.url }}" alt="{{ chap.front.title }}">
<a href="{{ root_offset|safe }}{{ chap.front.url }}" alt="{{ chap.front.title }}">
<span class="icon">
{% if chapter.sections.len() > 0 && chapter.front.url.ends_with("index.html") %}
<svg class="icon-arrow-up">
<use xlink:href="../icons.svg#icon-arrow-up">
<use xlink:href="{{ root_offset|safe }}icons.svg#icon-arrow-up">
</svg>
{% else %}
<svg class="icon-arrow-left">
<use xlink:href="../icons.svg#icon-arrow-left">
<use xlink:href="{{ root_offset|safe }}icons.svg#icon-arrow-left">
</svg>
{% endif %}
</span>
@ -69,10 +69,10 @@
<span class="placeholder"></span>
{% match next_chapter %}
{% when Some with (chapter) %}
<a href="../{{ chapter.front.url }}" alt="{{ chapter.front.title }}">
<a href="{{ root_offset|safe }}{{ chapter.front.url }}" alt="{{ chapter.front.title }}">
<span class="icon">
<svg class="icon-arrow-right">
<use xlink:href="../icons.svg#icon-arrow-right">
<use xlink:href="{{ root_offset|safe }}icons.svg#icon-arrow-right">
</svg>
</span>
</a>
@ -82,15 +82,16 @@
</span>
</nav>
<article>
<h1 class="title">{{ chapter.front.title }}</h1>
{{ content|safe }}
{% match next_chapter %}
{% when Some with (chapter) %}
<div class="next-chapter">
<a href="../{{ chapter.front.url }}">
<a href="{{ root_offset|safe }}{{ chapter.front.url }}">
<span>Next chapter: “{{ chapter.front.title }}”</span>
<span class="icon">
<svg class="icon-arrow-right">
<use xlink:href="../icons.svg#icon-arrow-right">
<use xlink:href="{{ root_offset|safe }}icons.svg#icon-arrow-right">
</svg>
</span>
</a>

Loading…
Cancel
Save