MdBook – a command line tool to create books with Markdown
rust-lang.github.io
rust-lang.github.io
If you are typesetting a research paper or writing a technical book for print publication typst is a great solution, but for a lot folks not having web support is an absolute dealbreaker.
All of this stuff is crazy useful in typesetting. I love markdown, but its missing too many features.
Why? because Asciidoc/tor gives you a lot more:
- a syntax with callouts, tables, indexes, comments, notes and everything you may need in a book
- macro expansion
- a ton of complex diagrams via PlantUML (veeery useful!) that you can keep inline
- a ton of output formats, including "real" paper books via Docbook.
Jekyll - written in Ruby
Hugo - written in Go
Zola - written in Rust
As much as I love html outputs, it’s far easier to just email a pdf to my tech unsavvy stakeholders.
I’ll share my file header and config chunks with you tomorrow when I’m at the office! I’ll ping you with a separate reply.
FWIW, when you click "Render", this is the output command that RStudio shows: `quarto preview FILE.qmd --to pdf --no-watch-inputs --no-browse`
Of course, you will have to remember to properly format tables, omit `&` where possible in tables, figure titles, etc. There are so many nuances, but once you've got them figured out, report generation is very smooth.
---
title: Title
author: Author Name
date: today
date-format: long
pdf-engine: xelatex
format:
pdf:
number-sections: true
toc: true
toc-depth: 3
mainfont: Roboto # available fonts are dependent on your machine/environment
sansfont: Roboto
include-in-header:
text: |
\usepackage{fancyhdr}
\usepackage{lastpage}
\usepackage{float}
\pagestyle{fancy}
\fancyhead[L]{\empty}
\fancyfoot[R]{[Company] Confidential}
\fancyfoot[C]{\thepage\ of \pageref*{LastPage}}
---
```{r setup, echo=FALSE, include=FALSE}
knitr::opts_chunk$set(fig.align = "center",
warning = FALSE,
echo = FALSE,
message = FALSE,
dev = "cairo_pdf")
```
{{< include 001_QC.qmd >}}
{{< include 002_ANALYSIS_FILE.qmd >}}
<!-- And so on. -->I use my Markdown editor[1] to produce my blog[2].
keenwrite.bin -q -i "${FILE_MD}" -o "${FILE_HTML}" \
--curl-quotes=true
Offers external variable sources, too; see [3] and [4].[2]: https://dave.autonoma.ca/blog/
[3]: https://gitlab.com/DaveJarvis/KeenWrite/-/blob/main/docs/cmd...
MkDocs or Docusaurus for documentation. MdBook is not in the running, IMO, unless it’s radically improved since the last time I checked.
And here’s my hot take—most generators have a lot of the same design flaws. Routing is generally a mistake—you should instead design a system where every page has a URL that directly corresponds to the source file path, if feasible. Shortcodes are a mistake—you should use custom HTML tags. SSGs should have e.g. S3+Cloudfront as a core part of their design rather than just thinking of S3 as a place you put files when you’re done.
You should consider the people who deploy to systems like S3+Cloudfront when designing your static site generator. Too many systems are just designed to be served from the filesystem and there are rough edges when you deploy to something like S3.
And “design for S3+Cloudfront” does not mean the same thing as “design it so that people without S3+Cloudfront are screwed”. That’s some kind of extrapolation.
The main relevant difference between e.g. S3 and a filesystem is that you can (and probably should) deploy pages to paths like /blog/hello/ rather than /blog/hello/index.html. There are other differences—it gets somewhat pervasive, unfortunately. There are hacks and workarounds but it would be nice if the SSGs were designed with cloud storage in mind as one of the core features, rather than an afterthought.
(It may seem funny that I keep saying “e.g.” but that’s because I’m not talking about S3 specifically, but speaking about a broader class of storage systems.)
On another note, I really like the way Cloudfront describes their "edge" offerings without having very annoying and obtuse usages of the word "edge": "Reduce latency by delivering data through 600+ globally dispersed Points of Presence (PoPs) with automated network mapping and intelligent routing."
This might be the first time I've seen anything on an AWS explained concisely and precisely /s (sorta).
With Zola you just download the same version of the binary you used last time (or even commit said binary to the repo alongside the files) and you're on your way.
It fits in well with the general static site ethos of minimalism and constancy.
I actually got a lot of good references from this thread.
[3] https://gurudas.dev/blog/2023/06/07/how-i-generate-gurudas-d...
https://awesome.haunt.page/
A few hand-picked examples: https://jakob.space/blog/decompilation-by-hand.html
https://guix.gnu.org/en/download/latest/
https://www.gnu.org/software/guile/learn/Issue is that the file system layout is more like this:
/Product A/images/
/Product A/revision.tex
/Product A/instalwin7.tex
/Product A/instalwin10.tex
/Product A/layout.tex
/Product B/layout.tex
/Commmon/images/
/Common/companyinfo.tex
/Common/header.tex
/Win7/images
/Win7/access-cmd.tex
/Win10/images
/Win10/access-cmd.tex
Where Product A and Product B layout.tex links all LaTex files needed to build a complete document.
I chose `mdbook` over `pandoc` mainly because of themes and search provided by default.
If I could wave a wand and extend it in any way I chose, I'd want the ability to implement macros (or the equivalent) a la TeX, so as to automate doing fancier formatting in HTML.