mirror of
https://github.com/hamaluik/mkbook.git
synced 2024-11-16 00:13:01 +00:00
changed mkbook.toml to README.md, updated book to reflect changes
This commit is contained in:
parent
bfdc237e9c
commit
f8f79cf30a
6
assets/README.default.md
Normal file
6
assets/README.default.md
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
title = "My Cool Book"
|
||||
author = "Anonymous"
|
||||
---
|
||||
|
||||
A **short** but sweet description of _My Cool Book_.
|
@ -1,6 +0,0 @@
|
||||
title = "My Cool Book"
|
||||
author = "Anonymous"
|
||||
url = ""
|
||||
description = """
|
||||
A **short** but sweet description of _My Cool Book_.
|
||||
"""
|
@ -2,17 +2,21 @@
|
||||
title = "Introduction"
|
||||
---
|
||||
|
||||
# Introduction
|
||||
|
||||
_mkbook_ is my simpler alternative to [_mdbook_](https://crates.io/crates/mdbook) which is a great tool, but for which I really dislike some of the decisions they took, such as relying on javascript for highlighting and navigation, and including a lot of bells and whistles such as javascript-based search.
|
||||
|
||||
This tool aims to work somewhat similarly to _mdbook_, but is generally intended to be a more minimal alternative that is customized more towards my needs and desires than anything else.
|
||||
|
||||
If you're not familiar with _mdbook_, _mkbook_ is a tool to convert a collection of [Markdown](https://commonmark.org/) files into a static website / book which can be published online. It was created to help me write documentation with minimum fuss while presenting it in an easy-to-consume manner.
|
||||
|
||||
## Command-line Interface
|
||||
|
||||
_mkbook_ may be installed using _Cargo_ (`cargo install --force --path .` in the _mkbook_ repo directory), and after that it presents a command-line interface:
|
||||
|
||||
```
|
||||
```sh
|
||||
$ mkbook
|
||||
mkbook 0.1.0
|
||||
mkbook 0.2.0
|
||||
Kenton Hamaluik <kenton@hamaluik.ca>
|
||||
|
||||
|
||||
@ -33,9 +37,31 @@ SUBCOMMANDS:
|
||||
init initialize a mkbook directory tree
|
||||
```
|
||||
|
||||
Currently, only the `build` subcommand does anything (it builds your book!), but this functionality is still WIP:
|
||||
### The Init Command
|
||||
|
||||
The init command is a tool to help you get started, and will create an initial `README.md` file and a stub of your first chapter.
|
||||
|
||||
```sh
|
||||
$ mkbook init --help
|
||||
mkbook-init
|
||||
initialize a mkbook directory tree
|
||||
|
||||
USAGE:
|
||||
mkbook init [OPTIONS]
|
||||
|
||||
FLAGS:
|
||||
-h, --help Prints help information
|
||||
-V, --version Prints version information
|
||||
|
||||
OPTIONS:
|
||||
-d, --directory <directory> an optional directory to initialize into [default: src]
|
||||
```
|
||||
|
||||
### The Build Command
|
||||
|
||||
The build command is the primary command for _mkbook_, and is responsible for taking the `.md` files and building the resulting website.
|
||||
|
||||
```sh
|
||||
$ mkbook build --help
|
||||
mkbook-build
|
||||
build the book
|
||||
|
@ -1,7 +1,9 @@
|
||||
---
|
||||
title = "Commonmark"
|
||||
title = "CommonMark"
|
||||
---
|
||||
|
||||
# CommonMark
|
||||
|
||||
_mkbook_ nominally utilizes [CommonMark](https://commonmark.org/) with some [GFM](https://github.github.com/gfm/) extensions through the use of the [comrak](https://crates.io/crates/comrak) crate. In using _comrak_, a specific set of options are used, which are listed here:
|
||||
|
||||
```rust
|
||||
|
@ -2,6 +2,8 @@
|
||||
title = "Markdown"
|
||||
---
|
||||
|
||||
# Markdown
|
||||
|
||||
_mkbook_ relies pretty extensively on [Markdown](https://daringfireball.net/projects/markdown/) for its ease of use. If you're not familiar with _Markdown_, it is a simple markup language that is design to be easy to read and write in plain text, and then (relatively) easy for a computer to convert into other formats such as HTML or LaTeX.
|
||||
|
||||
The above paragraph looks like this:
|
||||
|
@ -2,16 +2,22 @@
|
||||
title = "Front Matter"
|
||||
---
|
||||
|
||||
Each `.md` file can optionally contain a header with metadata describing the document. If the header isn't present, default values will be used which may look ugly.
|
||||
# Front Matter
|
||||
|
||||
To insert a header into a `.md` file, insert three dashes (`---`), followed by a new-line, followed by the front matter contents, followed by a newline, then another three dashes and a new-line. The metadata is in the [TOML](https://github.com/toml-lang/toml) format, so for example the front-matter (and first line) for this file looks like:
|
||||
Each `.md` file can optionally contain a header with metadata describing the document. If the header isn't present, or if any keys are missing, default values will be used.
|
||||
|
||||
To insert a header into a `.md` file, insert three dashes (`---`), followed by a new-line, followed by the front matter contents, followed by a newline, then another three dashes and a new-line. The metadata is in the [TOML](https://github.com/toml-lang/toml) format, so for example the front-matter (and first line) for a file could look like this:
|
||||
|
||||
```md
|
||||
---
|
||||
title = "Front Matter"
|
||||
author = "Kenton Hamaluik"
|
||||
pubdate = 2019-11-29T15:22:00-07:00
|
||||
---
|
||||
|
||||
Each `.md` file can optionally contain a header with metadata describing the document. If the header isn't present, default values will be used which may look ugly.
|
||||
# Front Matter
|
||||
|
||||
Each `.md` file can optionally contain a header with metadata describing the document. If the header isn't present, or if any keys are missing, default values will be used.
|
||||
```
|
||||
|
||||
## Supported Keys
|
||||
@ -20,5 +26,16 @@ The list of supported keys is subject to change, but for now it is as follows:
|
||||
|
||||
title
|
||||
|
||||
: A human-readable title for the document
|
||||
: A human-readable title for the document (defaults to the filename)
|
||||
|
||||
author
|
||||
|
||||
: The author (or authors) who wrote the chapter (defaults to "Anonymous")
|
||||
|
||||
pubdate
|
||||
|
||||
: The [RFC 3339](http://tools.ietf.org/html/rfc3339) timestamp of when the chapter was published (defaults to the time at build)
|
||||
|
||||
url
|
||||
|
||||
: The relative URL of the file, defaults to the generated route (you probably shouldn't set this one)
|
||||
|
@ -2,31 +2,39 @@
|
||||
title = "Structure"
|
||||
---
|
||||
|
||||
_mkbook_ follows a fairly simple directory structure for now, with a `mkbook.toml` file declaring the book's metadata, and `.md` files defining each chapter of the book.
|
||||
# Structure
|
||||
|
||||
## `mkbook.toml`
|
||||
_mkbook_ follows a fairly simple directory structure for now, with a `README.md` file declaring the book's metadata, and `.md` files defining each chapter of the book.
|
||||
|
||||
_mkbook_ generally requires a `mkbook.toml` file to reside in your source directory. This file is responsible for defining the metadata associated with your book:
|
||||
## `README.md`
|
||||
|
||||
_mkbook_ generally requires a `README.md` file to reside in your source directory. This file is responsible for defining the metadata associated with your book:
|
||||
|
||||
* The book's title (`title`)
|
||||
* The book's author (`author`)
|
||||
* The publication date (`pubdate`)
|
||||
* The canonical URL for the book (`url`)
|
||||
* A markdown-formatted description of the book (`description`)
|
||||
* A markdown-formatted description of the book
|
||||
|
||||
If the `mkbook.toml` file or any of the entries are missing, default values will be used.
|
||||
If the `README.md` file or any of the entries are missing, default values will be used. The `README.md` file should be formatted as any other page, with the `title`, `author`, `pubdate`, and `url` specified in the frontmatter, and the book description the _Markdown_ contents of the `README.md` file.
|
||||
|
||||
### Sample
|
||||
|
||||
```toml
|
||||
```md
|
||||
---
|
||||
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.
|
||||
"""
|
||||
_mkbook_ is my simpler alternative to [mdbook](https://crates.io/crates/mdbook)
|
||||
which is a great tool, but for which I really dislike some of the decisions they
|
||||
took, such as relying on javascript for highlighting and navigation, and
|
||||
including a lot of bells and whistles such as javascript-based search.
|
||||
|
||||
This tool aims to work somewhat similarly to _mdbook_, but is generally intended
|
||||
to be a more minimal alternative that is customized more towards my needs and
|
||||
desires than anything else.
|
||||
```
|
||||
|
||||
### Default Values
|
||||
@ -53,9 +61,7 @@ This tool aims to work somewhat similarly to _mdbook_, but is generally intended
|
||||
|
||||
## Assets
|
||||
|
||||
```rust
|
||||
unimplemented!()
|
||||
```
|
||||
The current version of _mkbook_ doesn't copy any assets into your book—it only parses `.md` files and generates `.html` files. So if you want to include images or other assets, you're on your own. Support for assets is planned for the next minor release.
|
||||
|
||||
## Documents
|
||||
|
||||
|
@ -2,4 +2,6 @@
|
||||
title = "Customization"
|
||||
---
|
||||
|
||||
There isn't any way to customize the templates nor the CSS yet, though I will investigate this if the need arises.
|
||||
# Customization
|
||||
|
||||
There isn't any way to customize the templates nor the CSS yet, though I will investigate this if the need arises. This is because both the templates and CSS are currently compiled at compile-time instead of run-time.
|
||||
|
@ -2,6 +2,8 @@
|
||||
title = "How it Works"
|
||||
---
|
||||
|
||||
# How it Works
|
||||
|
||||
_mkbook_ generates a completely static, javascript-free website from a series of Markdown files. All of the layout and styling is controlled purely by hand-crafted CSS specific to this book's purpose.
|
||||
|
||||
## Assets
|
||||
|
@ -1,8 +1,9 @@
|
||||
---
|
||||
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.
|
||||
"""
|
@ -10,11 +10,9 @@
|
||||
<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="og:description" content="<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>
|
||||
" />
|
||||
|
||||
<meta property="book:author" content="Kenton Hamaluik" />
|
||||
<meta property="book:release_date" content="2019-11-29T21:43:28.060984725+00:00" />
|
||||
<meta property="book:release_date" content="2019-11-29T22:36:42.202445325+00:00" />
|
||||
</head>
|
||||
<body>
|
||||
<nav class="big">
|
||||
@ -34,7 +32,7 @@
|
||||
|
||||
<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>
|
||||
|
||||
@ -94,48 +92,68 @@
|
||||
</span>
|
||||
</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>
|
||||
<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 you’re 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:#d3d0c8;">$ mkbook
|
||||
</span><span style="color:#d3d0c8;">mkbook 0.1.0
|
||||
</span><span style="color:#d3d0c8;">Kenton Hamaluik <kenton@hamaluik.ca>
|
||||
<span style="color:#6699cc;">$</span><span style="color:#d3d0c8;"> mkbook
|
||||
</span><span style="color:#6699cc;">mkbook</span><span style="color:#d3d0c8;"> 0.2.0
|
||||
</span><span style="color:#6699cc;">Kenton</span><span style="color:#d3d0c8;"> Hamaluik <kenton@hamaluik.ca>
|
||||
</span><span style="color:#d3d0c8;">
|
||||
</span><span style="color:#d3d0c8;">
|
||||
</span><span style="color:#d3d0c8;">USAGE:
|
||||
</span><span style="color:#d3d0c8;"> mkbook [SUBCOMMAND]
|
||||
</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:#d3d0c8;">FLAGS:
|
||||
</span><span style="color:#d3d0c8;"> -h, --help
|
||||
</span><span style="color:#d3d0c8;"> Prints help information
|
||||
</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;"> -V, --version
|
||||
</span><span style="color:#d3d0c8;"> Prints version information
|
||||
</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:#d3d0c8;">SUBCOMMANDS:
|
||||
</span><span style="color:#d3d0c8;"> build build the book
|
||||
</span><span style="color:#d3d0c8;"> help Prints this message or the help of the given subcommand(s)
|
||||
</span><span style="color:#d3d0c8;"> init initialize a mkbook directory tree
|
||||
</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></pre>
|
||||
<p>Currently, only the <code>build</code> subcommand does anything (it builds your book!), but this functionality is still WIP:</p>
|
||||
<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:#d3d0c8;">$ mkbook build --help
|
||||
</span><span style="color:#d3d0c8;">mkbook-build
|
||||
</span><span style="color:#d3d0c8;">build the book
|
||||
<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:#d3d0c8;">USAGE:
|
||||
</span><span style="color:#d3d0c8;"> mkbook build [OPTIONS]
|
||||
</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:#d3d0c8;">FLAGS:
|
||||
</span><span style="color:#d3d0c8;"> -h, --help Prints help information
|
||||
</span><span style="color:#d3d0c8;"> -V, --version Prints version information
|
||||
</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:#d3d0c8;">OPTIONS:
|
||||
</span><span style="color:#d3d0c8;"> -i, --in <in> an optional directory to take the book sources from [default: src]
|
||||
</span><span style="color:#d3d0c8;"> -o, --out <out> an optional directory to render the contents into [default: book]
|
||||
</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;"><directory> 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;"><in> 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;"><out> 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>
|
||||
|
||||
|
||||
|
@ -3,18 +3,16 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>The mkbook Book | Commonmark</title>
|
||||
<title>The mkbook Book | CommonMark</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/01-commonmark.html" />
|
||||
<meta property="og:description" content="<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>
|
||||
" />
|
||||
|
||||
<meta property="book:author" content="Kenton Hamaluik" />
|
||||
<meta property="book:release_date" content="2019-11-29T21:43:28.060984725+00:00" />
|
||||
<meta property="book:release_date" content="2019-11-29T22:36:42.202445325+00:00" />
|
||||
</head>
|
||||
<body>
|
||||
<nav class="big">
|
||||
@ -34,7 +32,7 @@
|
||||
|
||||
<ol>
|
||||
|
||||
<li><a href="../02-markdown/01-commonmark.html" class = "current">Commonmark</a></li>
|
||||
<li><a href="../02-markdown/01-commonmark.html" class = "current">CommonMark</a></li>
|
||||
|
||||
<li><a href="../02-markdown/02-syntax-highlighting.html">Syntax Highlighting</a></li>
|
||||
|
||||
@ -86,7 +84,7 @@
|
||||
</a>
|
||||
|
||||
</span>
|
||||
<span class="title">Commonmark</span>
|
||||
<span class="title">CommonMark</span>
|
||||
<span>
|
||||
<span class="placeholder"></span>
|
||||
|
||||
@ -102,7 +100,8 @@
|
||||
</span>
|
||||
</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>
|
||||
<h1><a href="#commonmark" aria-hidden="true" class="anchor" id="headercommonmark"></a>CommonMark</h1>
|
||||
<p><em>mkbook</em> nominally utilizes <a href="https://commonmark.org/">CommonMark</a> with some <a href="https://github.github.com/gfm/">GFM</a> extensions through the use of the <a href="https://crates.io/crates/comrak">comrak</a> crate. In using <em>comrak</em>, a specific set of options are used, which are listed here:</p>
|
||||
<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;">,
|
||||
|
@ -10,11 +10,9 @@
|
||||
<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/02-syntax-highlighting.html" />
|
||||
<meta property="og:description" content="<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>
|
||||
" />
|
||||
|
||||
<meta property="book:author" content="Kenton Hamaluik" />
|
||||
<meta property="book:release_date" content="2019-11-29T21:43:28.060984725+00:00" />
|
||||
<meta property="book:release_date" content="2019-11-29T22:36:42.202445325+00:00" />
|
||||
</head>
|
||||
<body>
|
||||
<nav class="big">
|
||||
@ -34,7 +32,7 @@
|
||||
|
||||
<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" class = "current">Syntax Highlighting</a></li>
|
||||
|
||||
@ -75,7 +73,7 @@
|
||||
</a>
|
||||
|
||||
|
||||
<a href="../02-markdown/01-commonmark.html" alt="Commonmark">
|
||||
<a href="../02-markdown/01-commonmark.html" alt="CommonMark">
|
||||
<span class="icon">
|
||||
|
||||
<svg class="icon-arrow-left">
|
||||
|
@ -10,11 +10,9 @@
|
||||
<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/index.html" />
|
||||
<meta property="og:description" content="<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>
|
||||
" />
|
||||
|
||||
<meta property="book:author" content="Kenton Hamaluik" />
|
||||
<meta property="book:release_date" content="2019-11-29T21:43:28.060984725+00:00" />
|
||||
<meta property="book:release_date" content="2019-11-29T22:36:42.202445325+00:00" />
|
||||
</head>
|
||||
<body>
|
||||
<nav class="big">
|
||||
@ -34,7 +32,7 @@
|
||||
|
||||
<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>
|
||||
|
||||
@ -91,7 +89,7 @@
|
||||
<span class="placeholder"></span>
|
||||
|
||||
|
||||
<a href="../02-markdown/01-commonmark.html" alt="Commonmark">
|
||||
<a href="../02-markdown/01-commonmark.html" alt="CommonMark">
|
||||
<span class="icon">
|
||||
<svg class="icon-arrow-right">
|
||||
<use xlink:href="../icons.svg#icon-arrow-right">
|
||||
@ -102,7 +100,8 @@
|
||||
</span>
|
||||
</nav>
|
||||
<article>
|
||||
<p><em>mkbook</em> relies pretty extensively on <a href="https://daringfireball.net/projects/markdown/">Markdown</a> for its ease of use. If you’re 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>
|
||||
<h1><a href="#markdown" aria-hidden="true" class="anchor" id="headermarkdown"></a>Markdown</h1>
|
||||
<p><em>mkbook</em> relies pretty extensively on <a href="https://daringfireball.net/projects/markdown/">Markdown</a> for its ease of use. If you’re not familiar with <em>Markdown</em>, it is a simple markup language that is design to be easy to read and write in plain text, and then (relatively) easy for a computer to convert into other formats such as HTML or LaTeX.</p>
|
||||
<p>The above paragraph looks like this:</p>
|
||||
<pre style="background-color:#2d2d2d;">
|
||||
<span style="font-style:italic;color:#cc99cc;">_mkbook_</span><span style="color:#d3d0c8;"> relies pretty extensively on
|
||||
@ -117,7 +116,7 @@
|
||||
|
||||
<div class="next-chapter">
|
||||
<a href="../02-markdown/01-commonmark.html">
|
||||
<span>Next chapter: “Commonmark”</span>
|
||||
<span>Next chapter: “CommonMark”</span>
|
||||
<span class="icon">
|
||||
<svg class="icon-arrow-right">
|
||||
<use xlink:href="../icons.svg#icon-arrow-right">
|
||||
|
@ -10,11 +10,9 @@
|
||||
<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:description" content="<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>
|
||||
" />
|
||||
|
||||
<meta property="book:author" content="Kenton Hamaluik" />
|
||||
<meta property="book:release_date" content="2019-11-29T21:43:28.060984725+00:00" />
|
||||
<meta property="book:release_date" content="2019-11-29T22:36:42.202445325+00:00" />
|
||||
</head>
|
||||
<body>
|
||||
<nav class="big">
|
||||
@ -34,7 +32,7 @@
|
||||
|
||||
<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>
|
||||
|
||||
@ -102,14 +100,19 @@
|
||||
</span>
|
||||
</nav>
|
||||
<article>
|
||||
<p>Each <code>.md</code> file can optionally contain a header with metadata describing the document. If the header isn’t 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>
|
||||
<h1><a href="#front-matter" aria-hidden="true" class="anchor" id="headerfront-matter"></a>Front Matter</h1>
|
||||
<p>Each <code>.md</code> file can optionally contain a header with metadata describing the document. If the header isn’t present, or if any keys are missing, default values will be used.</p>
|
||||
<p>To insert a header into a <code>.md</code> file, insert three dashes (<code>---</code>), followed by a new-line, followed by the front matter contents, followed by a newline, then another three dashes and a new-line. The metadata is in the <a href="https://github.com/toml-lang/toml">TOML</a> format, so for example the front-matter (and first line) for a file could look like this:</p>
|
||||
<pre style="background-color:#2d2d2d;">
|
||||
<span style="background-color:#515151;color:#d3d0c8;">---
|
||||
</span><span style="color:#d3d0c8;">title = "Front Matter"
|
||||
</span><span style="color:#d3d0c8;">author = "Kenton Hamaluik"
|
||||
</span><span style="color:#d3d0c8;">pubdate = 2019-11-29T15:22:00-07:00
|
||||
</span><span style="color:#6699cc;">---
|
||||
</span><span style="color:#d3d0c8;">
|
||||
</span><span style="color:#d3d0c8;">Each </span><span style="color:#99cc99;">`.md`</span><span style="color:#d3d0c8;"> file can optionally contain a header with metadata describing the document. If the header isn't present, default values will be used which may look ugly.
|
||||
</span><span style="color:#6699cc;"># Front Matter
|
||||
</span><span style="color:#d3d0c8;">
|
||||
</span><span style="color:#d3d0c8;">Each </span><span style="color:#99cc99;">`.md`</span><span style="color:#d3d0c8;"> file can optionally contain a header with metadata describing the document. If the header isn't present, or if any keys are missing, default values will be used.
|
||||
</span></pre>
|
||||
<h2><a href="#supported-keys" aria-hidden="true" class="anchor" id="headersupported-keys"></a>Supported Keys</h2>
|
||||
<p>The list of supported keys is subject to change, but for now it is as follows:</p>
|
||||
@ -117,7 +120,25 @@
|
||||
<p>title</p>
|
||||
</dt>
|
||||
<dd>
|
||||
<p>A human-readable title for the document</p>
|
||||
<p>A human-readable title for the document (defaults to the filename)</p>
|
||||
</dd>
|
||||
<dt>
|
||||
<p>author</p>
|
||||
</dt>
|
||||
<dd>
|
||||
<p>The author (or authors) who wrote the chapter (defaults to “Anonymous”)</p>
|
||||
</dd>
|
||||
<dt>
|
||||
<p>pubdate</p>
|
||||
</dt>
|
||||
<dd>
|
||||
<p>The <a href="http://tools.ietf.org/html/rfc3339">RFC 3339</a> timestamp of when the chapter was published (defaults to the time at build)</p>
|
||||
</dd>
|
||||
<dt>
|
||||
<p>url</p>
|
||||
</dt>
|
||||
<dd>
|
||||
<p>The relative URL of the file, defaults to the generated route (you probably shouldn’t set this one)</p>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
|
@ -10,11 +10,9 @@
|
||||
<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:description" content="<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>
|
||||
" />
|
||||
|
||||
<meta property="book:author" content="Kenton Hamaluik" />
|
||||
<meta property="book:release_date" content="2019-11-29T21:43:28.060984725+00:00" />
|
||||
<meta property="book:release_date" content="2019-11-29T22:36:42.202445325+00:00" />
|
||||
</head>
|
||||
<body>
|
||||
<nav class="big">
|
||||
@ -34,7 +32,7 @@
|
||||
|
||||
<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>
|
||||
|
||||
@ -102,27 +100,34 @@
|
||||
</span>
|
||||
</nav>
|
||||
<article>
|
||||
<p><em>mkbook</em> follows a fairly simple directory structure for now, with a <code>mkbook.toml</code> file declaring the book’s metadata, and <code>.md</code> files defining each chapter of the book.</p>
|
||||
<h2><a href="#mkbooktoml" aria-hidden="true" class="anchor" id="headermkbooktoml"></a><code>mkbook.toml</code></h2>
|
||||
<p><em>mkbook</em> generally requires a <code>mkbook.toml</code> file to reside in your source directory. This file is responsible for defining the metadata associated with your book:</p>
|
||||
<h1><a href="#structure" aria-hidden="true" class="anchor" id="headerstructure"></a>Structure</h1>
|
||||
<p><em>mkbook</em> follows a fairly simple directory structure for now, with a <code>README.md</code> file declaring the book’s metadata, and <code>.md</code> files defining each chapter of the book.</p>
|
||||
<h2><a href="#readmemd" aria-hidden="true" class="anchor" id="headerreadmemd"></a><code>README.md</code></h2>
|
||||
<p><em>mkbook</em> generally requires a <code>README.md</code> file to reside in your source directory. This file is responsible for defining the metadata associated with your book:</p>
|
||||
<ul>
|
||||
<li>The book’s title (<code>title</code>)</li>
|
||||
<li>The book’s author (<code>author</code>)</li>
|
||||
<li>The publication date (<code>pubdate</code>)</li>
|
||||
<li>The canonical URL for the book (<code>url</code>)</li>
|
||||
<li>A markdown-formatted description of the book (<code>description</code>)</li>
|
||||
<li>A markdown-formatted description of the book</li>
|
||||
</ul>
|
||||
<p>If the <code>mkbook.toml</code> file or any of the entries are missing, default values will be used.</p>
|
||||
<p>If the <code>README.md</code> file or any of the entries are missing, default values will be used. The <code>README.md</code> file should be formatted as any other page, with the <code>title</code>, <code>author</code>, <code>pubdate</code>, and <code>url</code> specified in the frontmatter, and the book description the <em>Markdown</em> contents of the <code>README.md</code> file.</p>
|
||||
<h3><a href="#sample" aria-hidden="true" class="anchor" id="headersample"></a>Sample</h3>
|
||||
<pre style="background-color:#2d2d2d;">
|
||||
<span style="color:#f2777a;">title </span><span style="color:#d3d0c8;">= "</span><span style="color:#99cc99;">The mkbook Book</span><span style="color:#d3d0c8;">"
|
||||
</span><span style="color:#f2777a;">author </span><span style="color:#d3d0c8;">= "</span><span style="color:#99cc99;">Kenton Hamaluik</span><span style="color:#d3d0c8;">"
|
||||
</span><span style="color:#f2777a;">url </span><span style="color:#d3d0c8;">= "</span><span style="color:#99cc99;">https://hamaluik.github.io/mkbook/</span><span style="color:#d3d0c8;">"
|
||||
</span><span style="color:#f2777a;">description </span><span style="color:#d3d0c8;">= """
|
||||
</span><span style="color:#99cc99;">_mkbook_ is my simpler alternative to [mdbook](https://crates.io/crates/mdbook) which is a great tool, but for which I really dislike some of the decisions they took, such as relying on javascript for highlighting and navigation, and including a lot of bells and whistles such as javascript-based search.
|
||||
</span><span style="color:#99cc99;">
|
||||
</span><span style="color:#99cc99;">This tool aims to work somewhat similarly to _mdbook_, but is generally intended to be a more minimal alternative that is customized more towards my needs and desires than anything else.
|
||||
</span><span style="color:#d3d0c8;">"""
|
||||
<span style="background-color:#515151;color:#d3d0c8;">---
|
||||
</span><span style="color:#d3d0c8;">title = "The mkbook Book"
|
||||
</span><span style="color:#d3d0c8;">author = "Kenton Hamaluik"
|
||||
</span><span style="color:#d3d0c8;">url = "https://hamaluik.github.io/mkbook/"
|
||||
</span><span style="color:#6699cc;">---
|
||||
</span><span style="color:#d3d0c8;">
|
||||
</span><span style="font-style:italic;color:#cc99cc;">_mkbook_</span><span style="color:#d3d0c8;"> is my simpler alternative to </span><span style="color:#f99157;">[mdbook](https://crates.io/crates/mdbook)
|
||||
</span><span style="color:#d3d0c8;">which is a great tool, but for which I really dislike some of the decisions they
|
||||
</span><span style="color:#d3d0c8;">took, such as relying on javascript for highlighting and navigation, and
|
||||
</span><span style="color:#d3d0c8;">including a lot of bells and whistles such as javascript-based search.
|
||||
</span><span style="color:#d3d0c8;">
|
||||
</span><span style="color:#d3d0c8;">This tool aims to work somewhat similarly to </span><span style="font-style:italic;color:#cc99cc;">_mdbook_</span><span style="color:#d3d0c8;">, but is generally intended
|
||||
</span><span style="color:#d3d0c8;">to be a more minimal alternative that is customized more towards my needs and
|
||||
</span><span style="color:#d3d0c8;">desires than anything else.
|
||||
</span></pre>
|
||||
<h3><a href="#default-values" aria-hidden="true" class="anchor" id="headerdefault-values"></a>Default Values</h3>
|
||||
<dl><dt>
|
||||
@ -157,9 +162,7 @@
|
||||
</dd>
|
||||
</dl>
|
||||
<h2><a href="#assets" aria-hidden="true" class="anchor" id="headerassets"></a>Assets</h2>
|
||||
<pre style="background-color:#2d2d2d;">
|
||||
<span style="color:#d3d0c8;">unimplemented!()
|
||||
</span></pre>
|
||||
<p>The current version of <em>mkbook</em> doesn’t copy any assets into your book—it only parses <code>.md</code> files and generates <code>.html</code> files. So if you want to include images or other assets, you’re on your own. Support for assets is planned for the next minor release.</p>
|
||||
<h2><a href="#documents" aria-hidden="true" class="anchor" id="headerdocuments"></a>Documents</h2>
|
||||
<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 don’t end in a <code>.md</code> extension are completely ignored. Each <code>.md</code> file in the root source directly is it’s own chapter. To create chapters with sub-sections, create a sub-directory in the root directory and then create a <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> file’s 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 it’s based on Rust’s <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>
|
||||
|
@ -10,11 +10,9 @@
|
||||
<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:description" content="<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>
|
||||
" />
|
||||
|
||||
<meta property="book:author" content="Kenton Hamaluik" />
|
||||
<meta property="book:release_date" content="2019-11-29T21:43:28.060984725+00:00" />
|
||||
<meta property="book:release_date" content="2019-11-29T22:36:42.202445325+00:00" />
|
||||
</head>
|
||||
<body>
|
||||
<nav class="big">
|
||||
@ -34,7 +32,7 @@
|
||||
|
||||
<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>
|
||||
|
||||
@ -102,7 +100,8 @@
|
||||
</span>
|
||||
</nav>
|
||||
<article>
|
||||
<p>There isn’t any way to customize the templates nor the CSS yet, though I will investigate this if the need arises.</p>
|
||||
<h1><a href="#customization" aria-hidden="true" class="anchor" id="headercustomization"></a>Customization</h1>
|
||||
<p>There isn’t any way to customize the templates nor the CSS yet, though I will investigate this if the need arises. This is because both the templates and CSS are currently compiled at compile-time instead of run-time.</p>
|
||||
|
||||
|
||||
|
||||
|
@ -10,11 +10,9 @@
|
||||
<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:description" content="<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>
|
||||
" />
|
||||
|
||||
<meta property="book:author" content="Kenton Hamaluik" />
|
||||
<meta property="book:release_date" content="2019-11-29T21:43:28.060984725+00:00" />
|
||||
<meta property="book:release_date" content="2019-11-29T22:36:42.202445325+00:00" />
|
||||
</head>
|
||||
<body>
|
||||
<nav class="big">
|
||||
@ -34,7 +32,7 @@
|
||||
|
||||
<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>
|
||||
|
||||
@ -96,7 +94,8 @@
|
||||
</span>
|
||||
</nav>
|
||||
<article>
|
||||
<p><em>mkbook</em> generates a completely static, javascript-free website from a series of Markdown files. All of the layout and styling is controlled purely by hand-crafted CSS specific to this book’s purpose.</p>
|
||||
<h1><a href="#how-it-works" aria-hidden="true" class="anchor" id="headerhow-it-works"></a>How it Works</h1>
|
||||
<p><em>mkbook</em> generates a completely static, javascript-free website from a series of Markdown files. All of the layout and styling is controlled purely by hand-crafted CSS specific to this book’s purpose.</p>
|
||||
<h2><a href="#assets" aria-hidden="true" class="anchor" id="headerassets"></a>Assets</h2>
|
||||
<p><em>mkbook</em> currently bundles two assets which get written into the book directory: <code>favicon.ico</code>, and <code>icons.svg</code>. <code>favicon.ico</code> is the <a href="https://fontawesome.com/icons/book?style=solid">Font Awesome 5 book icon</a>, and <code>icons.svg</code> contains 3 <a href="https://fontawesome.com/">Font Awesome 5</a> arrow icons: <a href="https://fontawesome.com/icons/arrow-left?style=solid">arrow-left</a>, <a href="https://fontawesome.com/icons/arrow-right?style=solid">arrow-right</a>, and <a href="https://fontawesome.com/icons/arrow-up?style=solid">arrow-up</a> which are used for navigation. These files are compiled into the <em>mkbook</em> binary using the <a href="https://doc.rust-lang.org/std/macro.include_bytes.html"><code>include_bytes!</code> macro</a>, and written to the output folder on each build.</p>
|
||||
<h2><a href="#styling" aria-hidden="true" class="anchor" id="headerstyling"></a>Styling</h2>
|
||||
|
@ -14,13 +14,13 @@
|
||||
<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>
|
||||
" />
|
||||
<meta property="book:author" content="Kenton Hamaluik" />
|
||||
<meta property="book:release_date" content="2019-11-29T21:43:28.060984725+00:00" />
|
||||
<meta property="book:release_date" content="2019-11-29T22:36:42.202445325+00:00" />
|
||||
</head>
|
||||
<body class="toc">
|
||||
<header>
|
||||
<h1>The mkbook Book</h1>
|
||||
<h2>by Kenton Hamaluik</h2>
|
||||
<time datetime="2019-11-29T21:43:28.060984725+00:00">Nov 29, 2019</time>
|
||||
<time datetime="2019-11-29T22:36:42.202445325+00:00">Nov 29, 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>
|
||||
@ -41,7 +41,7 @@
|
||||
|
||||
<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>
|
||||
|
||||
|
68
src/main.rs
68
src/main.rs
@ -10,7 +10,7 @@ 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"));
|
||||
pub const ASSET_DEFAULT_MKBOOK: &'static [u8] = include_bytes!(concat!(env!("CARGO_MANIFEST_DIR"), "/assets/mkbook.default.toml"));
|
||||
pub const ASSET_DEFAULT_README: &'static [u8] = include_bytes!(concat!(env!("CARGO_MANIFEST_DIR"), "/assets/README.default.md"));
|
||||
pub const ASSET_DEFAULT_INTRODUCTION: &'static [u8] = include_bytes!(concat!(env!("CARGO_MANIFEST_DIR"), "/assets/01-introduction.default.md"));
|
||||
|
||||
pub const SYNTAX_TOML: &'static str = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/assets/syntaxes/TOML.sublime-syntax"));
|
||||
@ -70,7 +70,6 @@ mod models;
|
||||
mod filters;
|
||||
|
||||
use models::frontmatter::{ParsedFrontMatter, FrontMatter};
|
||||
use models::book::{ParsedBook, Book};
|
||||
use models::chapter::{Chapter};
|
||||
|
||||
fn format_code(lang: &str, src: &str) -> Result<String, Box<dyn std::error::Error>> {
|
||||
@ -170,16 +169,18 @@ fn format_markdown(src: &str) -> Result<String, Box<dyn std::error::Error>> {
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "index.html")]
|
||||
struct IndexTemplate<'a, 'b> {
|
||||
book: &'a Book,
|
||||
struct IndexTemplate<'a, 'b, 'c> {
|
||||
book: &'a FrontMatter,
|
||||
chapters: &'b Vec<Chapter>,
|
||||
book_description: &'c str,
|
||||
}
|
||||
|
||||
fn generate_index<W: io::Write>(book: &Book, chapters: &Vec<Chapter>, mut output: W) -> Result<(), Box<dyn std::error::Error>> {
|
||||
fn generate_index<W: io::Write>(book: &FrontMatter, content: String, chapters: &Vec<Chapter>, mut output: W) -> Result<(), Box<dyn std::error::Error>> {
|
||||
// fill out our template
|
||||
let template = IndexTemplate {
|
||||
book,
|
||||
chapters,
|
||||
book_description: &content,
|
||||
};
|
||||
|
||||
// and render!
|
||||
@ -191,22 +192,20 @@ fn generate_index<W: io::Write>(book: &Book, chapters: &Vec<Chapter>, mut output
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "page.html")]
|
||||
struct PageTemplate<'a, 'b, 'c, 'd, 'e, 'f, 'g> {
|
||||
struct PageTemplate<'a, 'b, 'c, 'd, 'e, 'g> {
|
||||
chapter: &'a Chapter,
|
||||
content: &'b str,
|
||||
url: &'f str,
|
||||
chapters: &'c Vec<Chapter>,
|
||||
prev_chapter: Option<&'d Chapter>,
|
||||
next_chapter: Option<&'e Chapter>,
|
||||
book: &'g Book,
|
||||
book: &'g FrontMatter,
|
||||
}
|
||||
|
||||
fn format_page<W: io::Write>(book: &Book, chapter: &Chapter, chapters: &Vec<Chapter>, prev_chapter: Option<&Chapter>, next_chapter: Option<&Chapter>, url: &str, content: &str, mut output: W) -> Result<(), Box<dyn std::error::Error>> {
|
||||
fn format_page<W: io::Write>(book: &FrontMatter, chapter: &Chapter, chapters: &Vec<Chapter>, prev_chapter: Option<&Chapter>, next_chapter: Option<&Chapter>, content: &str, mut output: W) -> Result<(), Box<dyn std::error::Error>> {
|
||||
// fill out our template
|
||||
let template = PageTemplate {
|
||||
chapter,
|
||||
content,
|
||||
url,
|
||||
chapters,
|
||||
prev_chapter,
|
||||
next_chapter,
|
||||
@ -229,8 +228,8 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
|
||||
println!("Initializing a book into {}...", dest.display());
|
||||
fs::create_dir_all(&dest)?;
|
||||
let book_toml_path = dest.join("mkbook.toml");
|
||||
fs::write(&book_toml_path, ASSET_DEFAULT_MKBOOK)?;
|
||||
let book_readme_path = dest.join("README.md");
|
||||
fs::write(&book_readme_path, ASSET_DEFAULT_README)?;
|
||||
let intro_path = dest.join("01-introduction.md");
|
||||
fs::write(&intro_path, ASSET_DEFAULT_INTRODUCTION)?;
|
||||
println!("Done!");
|
||||
@ -254,17 +253,18 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
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)
|
||||
let book_readme_path = src.join("README.md");
|
||||
let (book_front, book_description) = if book_readme_path.exists() {
|
||||
let contents = fs::read_to_string(&book_readme_path)?;
|
||||
let (front, contents) = extract_frontmatter(&contents)?;
|
||||
(front, contents)
|
||||
}
|
||||
else {
|
||||
None
|
||||
let content = String::new();
|
||||
(None, content)
|
||||
};
|
||||
let parsed_book = parsed_book.unwrap_or_default();
|
||||
let book: Book = parsed_book.into();
|
||||
let book_front = FrontMatter::from_root(book_front.unwrap_or_default());
|
||||
let book_description = format_markdown(&book_description)?;
|
||||
|
||||
// load all our chapters
|
||||
let mut chapters: Vec<Chapter> = Vec::default();
|
||||
@ -272,24 +272,21 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let entry = entry?;
|
||||
let path = entry.path();
|
||||
if entry.file_type()?.is_dir() {
|
||||
// try to find a `chapter.toml` file and parse it to get the chapter's title, fall back to the directory
|
||||
// try to find a `README.md` file and parse it to get the chapter's title, fall back to the directory
|
||||
// name if we can't do that
|
||||
let chapter_name = path.file_name().map(std::ffi::OsStr::to_str).flatten().unwrap_or_default();
|
||||
let index_path = path.join("README.md");
|
||||
let (front, contents) = if index_path.exists() {
|
||||
let contents = fs::read_to_string(&index_path)?;
|
||||
let (front, contents) = extract_frontmatter(&contents)?;
|
||||
let front = front.unwrap_or_default().into_front(chapter_name);
|
||||
let front = front.unwrap_or_default().into_front(&book_front, chapter_name, &format!("{}/index.html", chapter_name));
|
||||
(front, contents)
|
||||
}
|
||||
else {
|
||||
(FrontMatter {
|
||||
title: chapter_name.to_owned(),
|
||||
}, String::new())
|
||||
(ParsedFrontMatter::default().into_front(&book_front, chapter_name, &format!("{}/index.html", chapter_name)), String::new())
|
||||
};
|
||||
|
||||
let mut chapter: Chapter = Chapter {
|
||||
url: format!("{}/index.html", chapter_name),
|
||||
front,
|
||||
sections: Vec::default(),
|
||||
source: path.clone(),
|
||||
@ -309,9 +306,8 @@ fn main() -> Result<(), 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(name);
|
||||
let front = front.unwrap_or_default().into_front(&book_front, name, &format!("{}/{}.html", chapter_name, name));
|
||||
chapter.sections.push(Chapter {
|
||||
url: format!("{}/{}.html", chapter_name, name),
|
||||
front,
|
||||
sections: Vec::new(),
|
||||
source: path,
|
||||
@ -326,12 +322,14 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let name = path.file_stem().map(std::ffi::OsStr::to_str).flatten();
|
||||
if name.is_none() { continue; }
|
||||
let name = name.unwrap();
|
||||
if name == "README" {
|
||||
continue;
|
||||
}
|
||||
|
||||
let contents = fs::read_to_string(&path)?;
|
||||
let (front, contents) = extract_frontmatter(&contents)?;
|
||||
let front = front.unwrap_or_default().into_front(name);
|
||||
let front = front.unwrap_or_default().into_front(&book_front, name, &format!("{}/index.html", name));
|
||||
chapters.push(Chapter {
|
||||
url: format!("{}/index.html", name),
|
||||
front,
|
||||
sections: Vec::new(),
|
||||
source: path,
|
||||
@ -341,16 +339,16 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
}
|
||||
|
||||
// sort all the chapters
|
||||
chapters.sort_by(|a, b| a.url.cmp(&b.url));
|
||||
chapters.sort_by(|a, b| a.front.url.cmp(&b.front.url));
|
||||
for chapter in chapters.iter_mut() {
|
||||
chapter.sections.sort_by(|a, b| a.url.cmp(&b.url));
|
||||
chapter.sections.sort_by(|a, b| a.front.url.cmp(&b.front.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)?;
|
||||
generate_index(&book_front, book_description, &chapters, index_out)?;
|
||||
println!("Rendered index into `{}`", index_out_path.display());
|
||||
|
||||
// compile markdown and write the actual pages
|
||||
@ -378,7 +376,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
None
|
||||
};
|
||||
|
||||
format_page(&book, &chapter, &chapters, prev_chapter, next_chapter, &chapter.url, &contents, outfile)?;
|
||||
format_page(&book_front, &chapter, &chapters, prev_chapter, next_chapter, &contents, outfile)?;
|
||||
prev_chapter = Some(chapter);
|
||||
|
||||
println!(" done!");
|
||||
@ -404,7 +402,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
None
|
||||
};
|
||||
|
||||
format_page(&book, §ion, &chapters, prev_chapter, next_chapter, §ion.url, &contents, outfile)?;
|
||||
format_page(&book_front, §ion, &chapters, prev_chapter, next_chapter, &contents, outfile)?;
|
||||
prev_chapter = Some(section);
|
||||
|
||||
println!(" done!");
|
||||
|
@ -1,3 +1,2 @@
|
||||
pub mod book;
|
||||
pub mod chapter;
|
||||
pub mod frontmatter;
|
||||
|
@ -1,46 +0,0 @@
|
||||
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(),
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
@ -3,7 +3,6 @@ use super::frontmatter::FrontMatter;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Chapter {
|
||||
pub url: String,
|
||||
pub front: FrontMatter,
|
||||
pub sections: Vec<Chapter>,
|
||||
pub source: PathBuf,
|
||||
|
@ -1,22 +1,68 @@
|
||||
use serde::Deserialize;
|
||||
use chrono::prelude::*;
|
||||
|
||||
#[derive(Deserialize, Default, Debug)]
|
||||
pub struct ParsedFrontMatter {
|
||||
pub title: Option<String>,
|
||||
pub author: Option<String>,
|
||||
pub pubdate: Option<toml::value::Datetime>,
|
||||
pub url: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct FrontMatter {
|
||||
pub title: String,
|
||||
pub author: String,
|
||||
pub pubdate: DateTime<Utc>,
|
||||
pub url: String,
|
||||
}
|
||||
|
||||
impl ParsedFrontMatter {
|
||||
pub fn into_front(&self, file_name: &str) -> FrontMatter {
|
||||
pub fn into_front(&self, root_matter: &FrontMatter, file_name: &str, url: &str) -> FrontMatter {
|
||||
FrontMatter {
|
||||
title: match &self.title {
|
||||
Some(title) => title.clone(),
|
||||
None => file_name.to_owned(),
|
||||
},
|
||||
author: match &self.author {
|
||||
Some(author) => author.clone(),
|
||||
None => root_matter.author.clone(),
|
||||
},
|
||||
pubdate: match &self.pubdate {
|
||||
Some(pubdate) => DateTime::from(DateTime::parse_from_rfc3339(&pubdate.to_string()).expect("valid rfc3339 datetime")),
|
||||
None => Utc::now(),
|
||||
},
|
||||
url: match &self.url {
|
||||
Some(url) => url.clone(),
|
||||
None => url.to_owned(),
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl FrontMatter {
|
||||
pub fn from_root(root: ParsedFrontMatter) -> FrontMatter {
|
||||
let ParsedFrontMatter { title, author, pubdate, url } = root;
|
||||
|
||||
FrontMatter {
|
||||
title: title.unwrap_or("My Cool Book".to_owned()),
|
||||
author: author.unwrap_or("Anonymous".to_owned()),
|
||||
pubdate: match pubdate {
|
||||
Some(pubdate) => DateTime::from(DateTime::parse_from_rfc3339(&pubdate.to_string()).expect("valid rfc3339 datetime")),
|
||||
None => Utc::now(),
|
||||
},
|
||||
url: url.unwrap_or("".to_owned()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for FrontMatter {
|
||||
fn default() -> FrontMatter {
|
||||
FrontMatter {
|
||||
title: "My Cool Book".to_owned(),
|
||||
author: "Anonymous".to_owned(),
|
||||
pubdate: Utc::now(),
|
||||
url: String::new(),
|
||||
}
|
||||
}
|
||||
}
|
@ -10,7 +10,7 @@
|
||||
<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="og:description" content="{{ book_description }}" />
|
||||
<meta property="book:author" content="{{ book.author }}" />
|
||||
<meta property="book:release_date" content="{{ book.pubdate|rfc3339_utc }}" />
|
||||
</head>
|
||||
@ -21,18 +21,18 @@
|
||||
<time datetime="{{ book.pubdate|rfc3339_utc }}">{{ book.pubdate|human_date }}</time>
|
||||
</header>
|
||||
<article>
|
||||
{{ book.description|safe }}
|
||||
{{ book_description|safe }}
|
||||
</article>
|
||||
<nav>
|
||||
<h1>Table of Contents</h1>
|
||||
<ol>
|
||||
{% for chapter in chapters %}
|
||||
<li>
|
||||
<a href="{{ chapter.url|safe }}">{{ chapter.front.title }}</a>
|
||||
<a href="{{ chapter.front.url|safe }}">{{ chapter.front.title }}</a>
|
||||
{% if chapter.sections.len() > 0 %}
|
||||
<ol>
|
||||
{% for section in chapter.sections %}
|
||||
<li><a href="{{ section.url|safe }}">{{ section.front.title }}</a></li>
|
||||
<li><a href="{{ section.front.url|safe }}">{{ section.front.title }}</a></li>
|
||||
{% endfor %}
|
||||
</ol>
|
||||
{% endif %}
|
||||
|
@ -9,8 +9,8 @@
|
||||
<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="og:url" content="{{ book.url|safe }}/{{ chapter.front.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>
|
||||
@ -21,13 +21,13 @@
|
||||
<h2>by {{ book.author }}</h2>
|
||||
</header>
|
||||
<ol>
|
||||
{% for chapter in chapters %}
|
||||
{% for chap in chapters %}
|
||||
<li>
|
||||
<a href="../{{ chapter.url|safe }}"{% if url == chapter.url %} class = "current"{% endif %}>{{ chapter.front.title }}</a>
|
||||
{% if chapter.sections.len() > 0 %}
|
||||
<a href="../{{ 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 chapter.sections %}
|
||||
<li><a href="../{{ section.url|safe }}"{% if url == section.url %} class = "current"{% endif %}>{{ section.front.title }}</a></li>
|
||||
{% 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>
|
||||
{% endfor %}
|
||||
</ol>
|
||||
{% endif %}
|
||||
@ -46,9 +46,9 @@
|
||||
</a>
|
||||
{% match prev_chapter %}
|
||||
{% when Some with (chap) %}
|
||||
<a href="../{{ chap.url }}" alt="{{ chap.front.title }}">
|
||||
<a href="../{{ chap.front.url }}" alt="{{ chap.front.title }}">
|
||||
<span class="icon">
|
||||
{% if chapter.sections.len() > 0 && chapter.url.ends_with("index.html") %}
|
||||
{% 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">
|
||||
</svg>
|
||||
@ -68,7 +68,7 @@
|
||||
<span class="placeholder"></span>
|
||||
{% match next_chapter %}
|
||||
{% when Some with (chapter) %}
|
||||
<a href="../{{ chapter.url }}" alt="{{ chapter.front.title }}">
|
||||
<a href="../{{ chapter.front.url }}" alt="{{ chapter.front.title }}">
|
||||
<span class="icon">
|
||||
<svg class="icon-arrow-right">
|
||||
<use xlink:href="../icons.svg#icon-arrow-right">
|
||||
@ -85,7 +85,7 @@
|
||||
{% match next_chapter %}
|
||||
{% when Some with (chapter) %}
|
||||
<div class="next-chapter">
|
||||
<a href="../{{ chapter.url }}">
|
||||
<a href="../{{ chapter.front.url }}">
|
||||
<span>Next chapter: “{{ chapter.front.title }}”</span>
|
||||
<span class="icon">
|
||||
<svg class="icon-arrow-right">
|
||||
|
Loading…
Reference in New Issue
Block a user