generating index, added meta tags, added book.toml file, styling improvements

master
Kenton Hamaluik 5 years ago
parent 2aedd7aa8a
commit c4f87aedd8

40
Cargo.lock generated

@ -187,6 +187,16 @@ name = "cfg-if"
version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "chrono"
version = "0.4.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "clang-sys"
version = "0.28.1"
@ -404,8 +414,10 @@ name = "mkbook"
version = "0.1.0"
dependencies = [
"askama 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
"chrono 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)",
"clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)",
"comrak 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"sass-rs 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)",
"syntect 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -421,6 +433,15 @@ dependencies = [
"version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "num-integer"
version = "0.1.41"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "num-traits"
version = "0.2.10"
@ -563,6 +584,11 @@ dependencies = [
"proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "redox_syscall"
version = "0.1.56"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "regex"
version = "1.3.1"
@ -736,6 +762,16 @@ dependencies = [
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "time"
version = "0.1.42"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
"redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "toml"
version = "0.4.10"
@ -902,6 +938,7 @@ dependencies = [
"checksum cc 1.0.47 (registry+https://github.com/rust-lang/crates.io-index)" = "aa87058dce70a3ff5621797f1506cb837edd02ac4c0ae642b4542dce802908b8"
"checksum cexpr 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "fce5b5fb86b0c57c20c834c1b412fd09c77c8a59b9473f86272709e78874cd1d"
"checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
"checksum chrono 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "31850b4a4d6bae316f7a09e691c944c28299298837edc0a03f755618c23cbc01"
"checksum clang-sys 0.28.1 (registry+https://github.com/rust-lang/crates.io-index)" = "81de550971c976f176130da4b2978d3b524eaa0fd9ac31f3ceb5ae1231fb4853"
"checksum clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9"
"checksum comrak 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ea4c29f52463abf5c7a3ae33dd9b404e2031af82f547cfe65bfac17ba785ea2e"
@ -931,6 +968,7 @@ dependencies = [
"checksum memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88579771288728879b57485cc7d6b07d648c9f0141eb955f8ab7f9d45394468e"
"checksum miniz_oxide 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6f3f74f726ae935c3f514300cc6773a0c9492abc5e972d42ba0c0ebb88757625"
"checksum nom 4.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2ad2a91a8e869eeb30b9cb3119ae87773a8f4ae617f41b1eb9c154b2905f7bd6"
"checksum num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)" = "b85e541ef8255f6cf42bbfe4ef361305c6c135d10919ecc26126c4e5ae94bc09"
"checksum num-traits 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "d4c81ffc11c212fa327657cb19dd85eb7419e163b5b076bede2bdb5c974c07e4"
"checksum num_cpus 1.11.1 (registry+https://github.com/rust-lang/crates.io-index)" = "76dac5ed2a876980778b8b85f75a71b6cbf0db0b1232ee12f826bccb00d09d72"
"checksum onig 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e4e723fc996fff1aeab8f62205f3e8528bf498bdd5eadb2784d2d31f30077947"
@ -948,6 +986,7 @@ dependencies = [
"checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0"
"checksum quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1"
"checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe"
"checksum redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)" = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84"
"checksum regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dc220bd33bdce8f093101afe22a037b8eb0e5af33592e6a9caafff0d4cb81cbd"
"checksum regex-syntax 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)" = "11a7e20d1cce64ef2fed88b66d347f88bd9babb82845b2b858f3edbf59a4f716"
"checksum rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783"
@ -968,6 +1007,7 @@ dependencies = [
"checksum termcolor 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "96d6098003bde162e4277c70665bd87c326f5a0c3f3fbfb285787fa482d54e6e"
"checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
"checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b"
"checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f"
"checksum toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "758664fc71a3a69038656bee8b6be6477d2a6c315a6b81f7081f591bffa4111f"
"checksum toml 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "01d1404644c8b12b16bfcffa4322403a91a451584daaaa7c28d3152e6cbc98cf"
"checksum twoway 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6b40075910de3a912adbd80b5d8bad6ad10a23eeb1f5bf9d4006839e899ba5bc"

@ -12,6 +12,8 @@ clap = "2.33"
askama = "0.8"
serde = { version = "1.0", features = ["derive"] }
toml = "0.5"
lazy_static = "1.4"
chrono = "0.4"
[build-dependencies]
sass-rs = "0.2"

@ -1,7 +1,7 @@
# mkbook
**mkbook** is my simpler alternative to [mdbook](https://crates.io/crates/mdbook) which is a great tool, but for which I really dislike some of the decisions they took, such as relying on javascript for highlighting and navigation, and including a lot of bells and whistles such as javascript-based search.
_mkbook_ is my simpler alternative to [mdbook](https://crates.io/crates/mdbook) which is a great tool, 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.
Still very WIP, but it can convert `.md` files into fancy-looking `.html` files, demo it by building the `mkbook` book by running: `cargo run -- build -i docs-src -o docs` and then serving the `docs` directory. Alternatively, view these generated docs [here](https://hamaluik.github.io/mkbook/01-introduction.html).
Still very WIP, but it can convert `.md` files into fancy-looking `.html` files, demo it by building the _mkbook_ book by running: `cargo run -- build -i docs-src -o docs` and then serving the `docs` directory. Alternatively, view these generated docs [here](https://hamaluik.github.io/mkbook/).

@ -8,5 +8,9 @@
<title>arrow-right</title>
<path fill="currentColor" d="M190.5 66.9l22.2-22.2c9.4-9.4 24.6-9.4 33.9 0L441 239c9.4 9.4 9.4 24.6 0 33.9L246.6 467.3c-9.4 9.4-24.6 9.4-33.9 0l-22.2-22.2c-9.5-9.5-9.3-25 .4-34.3L311.4 296H24c-13.3 0-24-10.7-24-24v-32c0-13.3 10.7-24 24-24h287.4L190.9 101.2c-9.8-9.3-10-24.8-.4-34.3z"></path>
</symbol>
<symbol id="icon-arrow-up" viewBox="0 0 448 512">
<title>arrow-up</title>
<path fill="currentColor" d="M34.9 289.5l-22.2-22.2c-9.4-9.4-9.4-24.6 0-33.9L207 39c9.4-9.4 24.6-9.4 33.9 0l194.3 194.3c9.4 9.4 9.4 24.6 0 33.9L413 289.4c-9.5 9.5-25 9.3-34.3-.4L264 168.6V456c0 13.3-10.7 24-24 24h-32c-13.3 0-24-10.7-24-24V168.6L69.2 289.1c-9.3 9.8-24.8 10-34.3.4z"></path>
</symbol>
</defs>
</svg>

Before

Width:  |  Height:  |  Size: 963 B

After

Width:  |  Height:  |  Size: 1.3 KiB

@ -0,0 +1,8 @@
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.
"""

@ -3,31 +3,52 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Introduction</title>
<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.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-28T18:22:59.188707583+00:00" />
</head>
<body>
<nav class="big">
<a href="01-introduction.html" class = "current">Introduction</a>
<a href="02-markdown.html">Markdown</a>
<a href="03-frontmatter.html">Front Matter</a>
<a href="04-structure.html">Structure</a>
<header>
<h1><a href="index.html">The mkbook Book</a></h1>
<h2>by Kenton Hamaluik</h2>
</header>
<ol>
<li><a href="01-introduction.html" class = "current">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>
</ol>
</nav>
<nav class="small">
<span class="placeholder"></span>
<a href="index.html" alt="Table of Contents">
<span class="icon">
<svg class="icon-arrow-up">
<use xlink:href="icons.svg#icon-arrow-up">
</svg>
</span>
</a>
<span class="title">Introduction</span>
<a href="02-markdown.html">
<a href="02-markdown.html" alt="Markdown">
<span class="icon">
<svg class="icon-arrow-right">
<use xlink:href="icons.svg#icon-arrow-right">
@ -36,7 +57,8 @@
</a>
</nav>
<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>
<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><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;">
@ -78,6 +100,21 @@
</span><span style="color:#d3d0c8;"> -i, --in &lt;in&gt; an optional directory to take the book sources from [default: src]
</span><span style="color:#d3d0c8;"> -o, --out &lt;out&gt; an optional directory to render the contents into [default: book]
</span></pre>
</article>
<div class="next-chapter">
<a href="02-markdown.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>

@ -3,26 +3,41 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Markdown</title>
<title>The mkbook Book | Markdown</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//02-markdown.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-28T18:22:59.188707583+00:00" />
</head>
<body>
<nav class="big">
<a href="01-introduction.html">Introduction</a>
<a href="02-markdown.html" class = "current">Markdown</a>
<a href="03-frontmatter.html">Front Matter</a>
<a href="04-structure.html">Structure</a>
<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" class = "current">Markdown</a></li>
<li><a href="03-frontmatter.html">Front Matter</a></li>
<li><a href="04-structure.html">Structure</a></li>
</ol>
</nav>
<nav class="small">
<a href="01-introduction.html">
<a href="01-introduction.html" alt="Introduction">
<span class="icon">
<svg class="icon-arrow-left">
<use xlink:href="icons.svg#icon-arrow-left">
@ -33,7 +48,7 @@
<span class="title">Markdown</span>
<a href="03-frontmatter.html">
<a href="03-frontmatter.html" alt="Front Matter">
<span class="icon">
<svg class="icon-arrow-right">
<use xlink:href="icons.svg#icon-arrow-right">
@ -42,7 +57,8 @@
</a>
</nav>
<article><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>
<article>
<p><em>mkbook</em> nominally utilizes <a href="https://commonmark.org/">CommonMark</a> with some <a href="https://github.github.com/gfm/">GFM</a> extensions through the use of the <a href="https://crates.io/crates/comrak">comrak</a> crate. In using <em>comrak</em>, a specific set of options are used, which are listed here:</p>
<pre style="background-color:#2d2d2d;">
<span style="color:#cc99cc;">let</span><span style="color:#d3d0c8;"> options: ComrakOptions = ComrakOptions {
</span><span style="color:#d3d0c8;"> hardbreaks: </span><span style="color:#f99157;">false</span><span style="color:#d3d0c8;">,
@ -84,6 +100,21 @@
</span></pre>
</li>
</ul>
</article>
<div class="next-chapter">
<a href="03-frontmatter.html">
<span>Next chapter: “Front Matter”</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>

@ -3,26 +3,41 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Front Matter</title>
<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" />
<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.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-28T18:22:59.188707583+00:00" />
</head>
<body>
<nav class="big">
<a href="01-introduction.html">Introduction</a>
<a href="02-markdown.html">Markdown</a>
<a href="03-frontmatter.html" class = "current">Front Matter</a>
<a href="04-structure.html">Structure</a>
<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" class = "current">Front Matter</a></li>
<li><a href="04-structure.html">Structure</a></li>
</ol>
</nav>
<nav class="small">
<a href="02-markdown.html">
<a href="02-markdown.html" alt="Markdown">
<span class="icon">
<svg class="icon-arrow-left">
<use xlink:href="icons.svg#icon-arrow-left">
@ -33,7 +48,7 @@
<span class="title">Front Matter</span>
<a href="04-structure.html">
<a href="04-structure.html" alt="Structure">
<span class="icon">
<svg class="icon-arrow-right">
<use xlink:href="icons.svg#icon-arrow-right">
@ -42,7 +57,8 @@
</a>
</nav>
<article><p>Each <code>.md</code> file can optionally contain a header with metadata describing the document. If the header isnt present, default values will be used which may look ugly.</p>
<article>
<p>Each <code>.md</code> file can optionally contain a header with metadata describing the document. If the header isnt present, default values will be used which may look ugly.</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 this file looks like:</p>
<pre style="background-color:#2d2d2d;">
<span style="background-color:#515151;color:#d3d0c8;">---
@ -60,6 +76,21 @@
<p>A human-readable title for the document</p>
</dd>
</dl>
</article>
<div class="next-chapter">
<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">
</svg>
</span>
</a>
</div>
<footer><p>&copy; 2019 Kenton Hamaluik</p></footer>
</article>
</body>
</html>

@ -3,26 +3,41 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Structure</title>
<title>The mkbook Book | Structure</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//04-structure.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-28T18:22:59.188707583+00:00" />
</head>
<body>
<nav class="big">
<a href="01-introduction.html">Introduction</a>
<a href="02-markdown.html">Markdown</a>
<a href="03-frontmatter.html">Front Matter</a>
<a href="04-structure.html" class = "current">Structure</a>
<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" class = "current">Structure</a></li>
</ol>
</nav>
<nav class="small">
<a href="03-frontmatter.html">
<a href="03-frontmatter.html" alt="Front Matter">
<span class="icon">
<svg class="icon-arrow-left">
<use xlink:href="icons.svg#icon-arrow-left">
@ -36,7 +51,8 @@
<span class="placeholder"></span>
</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>
<article>
<p><em>mkbook</em> currently only supports two types of assets to use in rendering: assets (images, etc), and documents (markdown files).</p>
<h2><a href="#assets" aria-hidden="true" class="anchor" id="headerassets"></a>Assets</h2>
<pre style="background-color:#2d2d2d;">
<span style="color:#d3d0c8;">unimplemented!()
@ -51,6 +67,11 @@
</span><span style="color:#d3d0c8;">└── etc...
</span></pre>
<p>An index and navigation will be automatically generated from these files, taking the information for each file from its front-matter.</p>
</article>
<footer><p>&copy; 2019 Kenton Hamaluik</p></footer>
</article>
</body>
</html>

@ -8,5 +8,9 @@
<title>arrow-right</title>
<path fill="currentColor" d="M190.5 66.9l22.2-22.2c9.4-9.4 24.6-9.4 33.9 0L441 239c9.4 9.4 9.4 24.6 0 33.9L246.6 467.3c-9.4 9.4-24.6 9.4-33.9 0l-22.2-22.2c-9.5-9.5-9.3-25 .4-34.3L311.4 296H24c-13.3 0-24-10.7-24-24v-32c0-13.3 10.7-24 24-24h287.4L190.9 101.2c-9.8-9.3-10-24.8-.4-34.3z"></path>
</symbol>
<symbol id="icon-arrow-up" viewBox="0 0 448 512">
<title>arrow-up</title>
<path fill="currentColor" d="M34.9 289.5l-22.2-22.2c-9.4-9.4-9.4-24.6 0-33.9L207 39c9.4-9.4 24.6-9.4 33.9 0l194.3 194.3c9.4 9.4 9.4 24.6 0 33.9L413 289.4c-9.5 9.5-25 9.3-34.3-.4L264 168.6V456c0 13.3-10.7 24-24 24h-32c-13.3 0-24-10.7-24-24V168.6L69.2 289.1c-9.3 9.8-24.8 10-34.3.4z"></path>
</symbol>
</defs>
</svg>

Before

Width:  |  Height:  |  Size: 963 B

After

Width:  |  Height:  |  Size: 1.3 KiB

@ -0,0 +1,46 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>The mkbook Book</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/" />
<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-28T18:22:59.188707583+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>
</header>
<article>
<p><em>mkbook</em> is my simpler alternative to <a href="https://crates.io/crates/mdbook">mdbook</a> which is a great tool, but for which I really dislike some of the decisions they took, such as relying on javascript for highlighting and navigation, and including a lot of bells and whistles such as javascript-based search.</p>
<p>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>
</article>
<nav>
<h1>Table of Contents</h1>
<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>
</ol>
</nav>
<footer><p>&copy; 2019 Kenton Hamaluik</p></footer>
</body>
</html>

File diff suppressed because one or more lines are too long

@ -0,0 +1,13 @@
use chrono::prelude::*;
pub fn rfc3339_utc(d: &DateTime<Utc>) -> askama::Result<String> {
Ok(d.to_rfc3339())
}
pub fn human_date(d: &DateTime<Utc>) -> askama::Result<String> {
Ok(d.format("%b %e, %Y").to_string())
}
pub fn year(d: &DateTime<Utc>) -> askama::Result<String> {
Ok(d.format("%Y").to_string())
}

@ -1,24 +1,52 @@
#[macro_use]
extern crate lazy_static;
use std::path::PathBuf;
use std::{fs, io};
use comrak::ComrakOptions;
use syntect::{parsing::SyntaxSet, highlighting::{ThemeSet, Theme}};
use askama::Template;
pub const STYLESHEET: &'static str = include_str!(concat!(env!("OUT_DIR"), "/style.css"));
pub const ASSET_FAVICON: &'static [u8] = include_bytes!(concat!(env!("CARGO_MANIFEST_DIR"), "/assets/favicon.ico"));
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_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 {
hardbreaks: false,
smart: true,
github_pre_lang: false,
default_info_string: None,
unsafe_: true,
ext_strikethrough: true,
ext_tagfilter: false,
ext_table: true,
ext_autolink: true,
ext_tasklist: true,
ext_superscript: true,
ext_header_ids: Some("header".to_owned()),
ext_footnotes: true,
ext_description_lists: true,
..ComrakOptions::default()
};
}
mod cli;
mod models;
mod filters;
use models::frontmatter::{ParsedFrontMatter, FrontMatter};
use models::book::{ParsedBook, Book};
fn format_code(lang: &str, src: &str) -> Result<String, Box<dyn std::error::Error>> {
use syntect::parsing::{SyntaxSet, SyntaxReference};
use syntect::highlighting::{ThemeSet};
use syntect::parsing::SyntaxReference;
use syntect::html::highlighted_html_for_string;
let ss = SyntaxSet::load_defaults_newlines();
let ts = ThemeSet::load_defaults();
let theme = &ts.themes["base16-eighties.dark"];
let syntax: Option<&SyntaxReference> = if lang.len() > 0 {
let syntax = ss.find_syntax_by_token(lang);
let syntax = HIGHLIGHT_SYNTAX_SETS.find_syntax_by_token(lang);
if syntax.is_none() {
eprintln!("warning: language `{}` not recognized, formatting code block as plain text!", lang);
}
@ -27,14 +55,14 @@ fn format_code(lang: &str, src: &str) -> Result<String, Box<dyn std::error::Erro
else {
None
};
let syntax = syntax.unwrap_or(ss.find_syntax_plain_text());
let syntax = syntax.unwrap_or(HIGHLIGHT_SYNTAX_SETS.find_syntax_plain_text());
let html = highlighted_html_for_string(src, &ss, &syntax, &theme);
let html = highlighted_html_for_string(src, &HIGHLIGHT_SYNTAX_SETS, &syntax, &HIGHLIGHT_THEME);
Ok(html)
}
fn extract_frontmatter(src: &str) -> Result<(Option<models::frontmatter::ParsedFrontMatter>, String), Box<dyn std::error::Error>> {
fn extract_frontmatter(src: &str) -> Result<(Option<ParsedFrontMatter>, String), Box<dyn std::error::Error>> {
if src.starts_with("---\n") {
let slice = &src[4..];
let end = slice.find("---\n");
@ -45,7 +73,7 @@ fn extract_frontmatter(src: &str) -> Result<(Option<models::frontmatter::ParsedF
let front = &slice[..end];
let contents = &slice[end+4..];
let front: models::frontmatter::ParsedFrontMatter = toml::from_str(front)?;
let front: ParsedFrontMatter = toml::from_str(front)?;
Ok((Some(front), contents.to_owned()))
}
else if src.starts_with("---\r\n") {
@ -58,7 +86,7 @@ fn extract_frontmatter(src: &str) -> Result<(Option<models::frontmatter::ParsedF
let front = &slice[..end];
let contents = &slice[end+5..];
let front: models::frontmatter::ParsedFrontMatter = toml::from_str(front)?;
let front: ParsedFrontMatter = toml::from_str(front)?;
Ok((Some(front), contents.to_owned()))
}
else {
@ -67,33 +95,15 @@ fn extract_frontmatter(src: &str) -> Result<(Option<models::frontmatter::ParsedF
}
fn format_markdown(src: &str) -> Result<String, Box<dyn std::error::Error>> {
use comrak::{Arena, parse_document, format_html, ComrakOptions};
use comrak::{Arena, parse_document, format_html};
use comrak::nodes::{AstNode, NodeValue};
let options: ComrakOptions = ComrakOptions {
hardbreaks: false,
smart: true,
github_pre_lang: false,
default_info_string: None,
unsafe_: true,
ext_strikethrough: true,
ext_tagfilter: false,
ext_table: true,
ext_autolink: true,
ext_tasklist: true,
ext_superscript: true,
ext_header_ids: Some("header".to_owned()),
ext_footnotes: true,
ext_description_lists: true,
..ComrakOptions::default()
};
let arena = Arena::new();
let root = parse_document(
&arena,
src,
&options);
&COMRAK_OPTIONS);
fn iter_nodes<'a, F>(node: &'a AstNode<'a>, f: &F) -> Result<(), Box<dyn std::error::Error>>
where F : Fn(&'a AstNode<'a>) -> Result<(), Box<dyn std::error::Error>> {
@ -121,24 +131,45 @@ fn format_markdown(src: &str) -> Result<String, Box<dyn std::error::Error>> {
})?;
let mut output: Vec<u8> = Vec::with_capacity((src.len() as f64 * 1.2) as usize);
format_html(root, &options, &mut output).expect("can format HTML");
format_html(root, &COMRAK_OPTIONS, &mut output).expect("can format HTML");
let output = String::from_utf8(output).expect("valid utf-8 generated HTML");
Ok(output)
}
fn format_page<W: io::Write>(frontmatter: models::frontmatter::FrontMatter, chapters: &Vec<models::chapter::Chapter>, url: &str, content: &str, mut output: W) -> Result<(), Box<dyn std::error::Error>> {
use askama::Template;
#[derive(Template)]
#[template(path = "page.html")]
struct PageTemplate<'a, 'b, 'c, 'd, 'e, 'f> {
title: &'a str,
content: &'b str,
url: &'f str,
chapters: &'c Vec<models::chapter::Chapter>,
prev_chapter: Option<&'d models::chapter::Chapter>,
next_chapter: Option<&'e models::chapter::Chapter>,
}
#[derive(Template)]
#[template(path = "index.html")]
struct IndexTemplate<'a, 'b> {
book: &'a Book,
chapters: &'b Vec<models::chapter::Chapter>,
}
fn generate_index<W: io::Write>(book: &Book, chapters: &Vec<models::chapter::Chapter>, mut output: W) -> Result<(), Box<dyn std::error::Error>> {
// fill out our template
let template = IndexTemplate {
book,
chapters,
};
// and render!
let s = template.render()?;
output.write_all(s.as_bytes())?;
Ok(())
}
#[derive(Template)]
#[template(path = "page.html")]
struct PageTemplate<'a, 'b, 'c, 'd, 'e, 'f, 'g> {
title: &'a str,
content: &'b str,
url: &'f str,
chapters: &'c Vec<models::chapter::Chapter>,
prev_chapter: Option<&'d models::chapter::Chapter>,
next_chapter: Option<&'e models::chapter::Chapter>,
book: &'g Book,
}
fn format_page<W: io::Write>(book: &Book, frontmatter: FrontMatter, chapters: &Vec<models::chapter::Chapter>, url: &str, content: &str, mut output: W) -> Result<(), Box<dyn std::error::Error>> {
let this_index = chapters.iter().enumerate().find(|(_, chap)| chap.url == url).map(|(i, _)| i).expect("chapter exists");
let prev_chapter = if this_index > 0 {
Some(chapters.iter().nth(this_index - 1).expect("chapter n-1 exists"))
@ -161,6 +192,7 @@ fn format_page<W: io::Write>(frontmatter: models::frontmatter::FrontMatter, chap
chapters,
prev_chapter,
next_chapter,
book,
};
// and render!
@ -184,6 +216,19 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
let dest = PathBuf::from(dest);
std::fs::create_dir_all(&dest)?;
// load our book
let book_toml_path = src.join("mkbook.toml");
let parsed_book: Option<ParsedBook> = if book_toml_path.exists() {
let contents = fs::read_to_string(&book_toml_path)?;
let contents: ParsedBook = toml::from_str(&contents)?;
Some(contents)
}
else {
None
};
let parsed_book = parsed_book.unwrap_or_default();
let book: Book = parsed_book.into();
// load all our chapters
let mut chapters: Vec<models::chapter::Chapter> = Vec::default();
for entry in src.read_dir()? {
@ -205,6 +250,13 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
}
chapters.sort_by(|a, b| a.url.cmp(&b.url));
// generate our index
let index_out_path = dest.join("index.html");
let index_out = fs::File::create(&index_out_path)?;
let index_out = io::BufWriter::new(index_out);
generate_index(&book, &chapters, index_out)?;
println!("Rendered index into `{}`", index_out_path.display());
// compile markdown
for entry in src.read_dir()? {
let entry = entry?;
@ -222,7 +274,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
let (front, contents) = extract_frontmatter(&contents)?;
let front = front.unwrap_or_default().into_front(name);
let contents = format_markdown(&contents)?;
format_page(front, &chapters, &format!("{}.html", name), &contents, outfile)?;
format_page(&book, front, &chapters, &format!("{}.html", name), &contents, outfile)?;
println!("Rendered `{}` into `{}`", path.display(), out.display());
}

@ -1,2 +1,3 @@
pub mod book;
pub mod chapter;
pub mod frontmatter;

@ -0,0 +1,46 @@
use serde::Deserialize;
use chrono::prelude::*;
#[derive(Deserialize, Default)]
pub struct ParsedBook {
pub title: Option<String>,
pub author: Option<String>,
pub pubdate: Option<toml::value::Datetime>,
pub url: Option<String>,
pub description: Option<String>,
}
pub struct Book {
pub title: String,
pub author: String,
pub pubdate: DateTime<Utc>,
pub url: String,
pub description: String,
}
impl From<ParsedBook> for Book {
fn from(pb: ParsedBook) -> Book {
Book {
title: match pb.title {
Some(title) => title.clone(),
None => "My Cool Book".to_owned(),
},
author: match pb.author {
Some(author) => author.clone(),
None => "Anonymous".to_owned(),
},
pubdate: match pb.pubdate {
Some(pubdate) => DateTime::from(DateTime::parse_from_rfc3339(&pubdate.to_string()).expect("valid rfc3339 datetime")),
None => Utc::now(),
},
url: match pb.url {
Some(url) => url.clone(),
None => "".to_owned(),
},
description: match pb.description {
Some(description) => super::super::format_markdown(&description).expect("book description is valid markdown"),
None => "".to_owned(),
},
}
}
}

@ -43,7 +43,7 @@ figure {
}
}
code {
code, kbd {
margin: 0 2px;
padding: 0 2px;
border: 1px solid #4c566a;
@ -53,6 +53,12 @@ code {
font-size: 0.75em;
}
kbd {
color: #222222;
background: #eeeeee;
box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.5);
}
pre {
overflow-x: auto;
font-family: $font-mono;
@ -81,3 +87,14 @@ dl {
}
}
}
p {
margin-top: 0;
}
footer {
color: #444444;
p {
margin-right: 0.5em;
}
}

@ -25,4 +25,8 @@
border-right: 1px solid #333333;
}
}
footer {
color: #cccccc;
}
}

@ -19,4 +19,8 @@ span.icon {
.icon-arrow-right {
width: 0.875em;
}
.icon-arrow-up {
width: 0.875em;
}

@ -12,28 +12,70 @@ body {
nav.big {
background: #2c2c38;
padding: 1em;
padding: 0.5em 1em 1em;
display: flex;
flex-direction: column;
a {
width: 100%;
font-size: 1.5em;
text-decoration: none;
font-family: $font-sansserif;
margin: 0 0 0.25em 0;
color: #5babd1;
header {
margin: 0 0 1em;
display: flex;
flex-direction: column;
align-items: stretch;
border-bottom: 2px solid #888888;
&:hover {
color: #cf5ccd;
h1 {
font-size: 1.5em;
font-weight: 700;
font-family: $font-sansserif;
margin-bottom: 0;
text-align: left;
color: #eeeeee;
a {
color: #eeeeee;
text-decoration: none;
&:hover {
color: #cf5ccd;
}
}
}
h2 {
font-size: 1em;
font-weight: 600;
font-family: $font-sansserif;
margin-bottom: 0;
text-align: right;
}
}
&.current {
color: #cf5ccd;
ol {
margin: 0 2em;
padding: 0;
li {
width: 100%;
font-size: 1.25em;
font-family: $font-sansserif;
color: #eeeeee;
a {
text-decoration: none;
margin: 0 0 0.25em 0;
color: #5babd1;
&:hover {
color: #cf5ccd;
}
&.current {
color: #cf5ccd;
&:hover {
color: #fefefe;
&:hover {
color: #fefefe;
}
}
}
}
}
@ -72,17 +114,53 @@ body {
height: 1em;
}
}
>* {
min-width: 0;
min-height: 0;
}
article {
padding: 1em 2em 0 2em;
max-width: 38em;
min-width: 0;
min-height: 0;
padding: 0.5em 2em 0 2em;
>* {
max-width: 100%;
}
}
.next-chapter {
width: 100%;
a {
display: flex;
align-items: center;
justify-content: flex-end;
margin-right: 0.5em;
font-size: 1.2em;
text-decoration: none;
font-family: $font-sansserif;
color: #5babd1;
&:hover {
color: #cf5ccd;
}
span:first-child {
margin-right: 0.5em;
}
}
}
footer {
width: 100%;
text-align: right;
display: flex;
flex-direction: column;
align-items: flex-end;
justify-content: flex-end;
}
}
@media screen and (max-width: 768px) {

@ -2,6 +2,12 @@
body {
background: #ffffff;
color: #000000;
&:not(.toc) {
nav {
display: none;
}
}
}
a {
@ -27,10 +33,6 @@
overflow: hidden;
}
nav {
display: none;
}
body {
display: block;
}

@ -1,6 +1,7 @@
@import 'variables';
@import 'base';
@import 'layout';
@import 'toc';
@import 'icons';
@import 'darktheme';
@import 'print';

@ -0,0 +1,101 @@
body.toc {
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: center;
>* {
width: 36em;
}
header {
margin-top: 1em;
display: flex;
flex-direction: column;
align-items: center;
h1 {
font-size: 3em;
font-weight: 700;
font-family: $font-sansserif;
margin-bottom: 0;
}
h2 {
font-size: 1em;
font-weight: 600;
font-family: $font-sansserif;
margin-bottom: 0;
}
time {
font-size: 1em;
font-weight: 400;
font-family: $font-serif;
}
}
nav {
background: none;
display: flex;
flex-direction: column;
align-items: stretch;
h1 {
text-align: left;
font-size: 2.5em;
font-weight: 600;
margin-bottom: 0;
}
ol {
margin: 0.25em 0 0;
li {
font-size: 1.5em;
font-family: $font-sansserif;
a {
text-decoration: none;
margin: 0 0 0.25em 0;
color: #5babd1;
&:hover {
color: #cf5ccd;
}
}
}
}
}
footer {
flex: 1;
}
}
@media screen and (max-width: 768px) {
body.toc {
>* {
width: 100%;
}
header {
h1, h2, time {
text-align: center;
}
}
article, nav {
padding: 0;
>* {
margin-left: 0.5em;
margin-right: 0.5em;
}
}
nav {
h1 {
font-size: 1.75em;
}
}
}
}

@ -0,0 +1,36 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{{ book.title }}</title>
<link rel="stylesheet" href="style.css" type="text/css" media="all" />
<link rel="shortcut icon" href="favicon.ico" />
<meta property="og:title" content="{{ book.title }}" />
<meta property="og:site_name" content="{{ book.title }}" />
<meta property="og:type" content="book" />
<meta property="og:url" content="{{ book.url|safe }}" />
<meta property="og:description" content="{{ book.description }}" />
<meta property="book:author" content="{{ book.author }}" />
<meta property="book:release_date" content="{{ book.pubdate|rfc3339_utc }}" />
</head>
<body class="toc">
<header>
<h1>{{ book.title }}</h1>
<h2>by {{ book.author }}</h2>
<time datetime="{{ book.pubdate|rfc3339_utc }}">{{ book.pubdate|human_date }}</time>
</header>
<article>
{{ book.description|safe }}
</article>
<nav>
<h1>Table of Contents</h1>
<ol>
{% for chapter in chapters %}
<li><a href="{{ chapter.url|safe }}">{{ chapter.title }}</a></li>
{% endfor %}
</ol>
</nav>
<footer><p>&copy; {{ book.pubdate|year }} {{ book.author }}</p></footer>
</body>
</html>

@ -3,20 +3,33 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{{ title }}</title>
<title>{{ book.title }} | {{ title }}</title>
<link rel="stylesheet" href="style.css" type="text/css" media="all" />
<link rel="shortcut icon" href="favicon.ico" />
<meta property="og:title" content="{{ book.title }}" />
<meta property="og:site_name" content="{{ book.title }}" />
<meta property="og:type" content="book" />
<meta property="og:url" content="{{ book.url|safe }}/{{ url|safe }}" />
<meta property="og:description" content="{{ book.description }}" />
<meta property="book:author" content="{{ book.author }}" />
<meta property="book:release_date" content="{{ book.pubdate|rfc3339_utc }}" />
</head>
<body>
<nav class="big">
{% for chapter in chapters %}
<a href="{{ chapter.url|safe }}"{% if url == chapter.url %} class = "current"{% endif %}>{{ chapter.title }}</a>
{% endfor %}
<header>
<h1><a href="index.html">{{ book.title }}</a></h1>
<h2>by {{ book.author }}</h2>
</header>
<ol>
{% for chapter in chapters %}
<li><a href="{{ chapter.url|safe }}"{% if url == chapter.url %} class = "current"{% endif %}>{{ chapter.title }}</a></li>
{% endfor %}
</ol>
</nav>
<nav class="small">
{% match prev_chapter %}
{% when Some with (chapter) %}
<a href="{{ chapter.url }}">
<a href="{{ chapter.url }}" alt="{{ chapter.title }}">
<span class="icon">
<svg class="icon-arrow-left">
<use xlink:href="icons.svg#icon-arrow-left">
@ -24,12 +37,18 @@
</span>
</a>
{% when None %}
<span class="placeholder"></span>
<a href="index.html" alt="Table of Contents">
<span class="icon">
<svg class="icon-arrow-up">
<use xlink:href="icons.svg#icon-arrow-up">
</svg>
</span>
</a>
{% endmatch %}
<span class="title">{{ title }}</span>
{% match next_chapter %}
{% when Some with (chapter) %}
<a href="{{ chapter.url }}">
<a href="{{ chapter.url }}" alt="{{ chapter.title }}">
<span class="icon">
<svg class="icon-arrow-right">
<use xlink:href="icons.svg#icon-arrow-right">
@ -40,6 +59,23 @@
<span class="placeholder"></span>
{% endmatch %}
</nav>
<article>{{ content|safe }}</article>
<article>
{{ content|safe }}
{% match next_chapter %}
{% when Some with (chapter) %}
<div class="next-chapter">
<a href="{{ chapter.url }}">
<span>Next chapter: “{{ chapter.title }}”</span>
<span class="icon">
<svg class="icon-arrow-right">
<use xlink:href="icons.svg#icon-arrow-right">
</svg>
</span>
</a>
</div>
{% when None %}
{% endmatch %}
<footer><p>&copy; {{ book.pubdate|year }} {{ book.author }}</p></footer>
</article>
</body>
</html>
Loading…
Cancel
Save