Templates for rendering Markdown
into HTML. For my very opinionated usage.
Rendering done via Python-Markdown
. Plenty
extensions to deal with the fancy stuff, see below. Styling code (.css
files) are
processed through autoprefixer
to add
vendor prefxes.
Served files could be prettified via Prettier, but are currently minified using a mix of cssnano, html-minifier and terser.
AstdocsExtension
to parseastdocs
-specific syntax.DeleteSubExtension
to introduce crossed out and subscript text.EmojiExtension
to add support for GitHub emojis.FootnoteExtension
to handle, well, footnotes.HighlightExtension
to single out code blocks.ImgExtension
for a [slightly] smarter image management via options embedded in the usual![]()
marker.InsertExtension
to support addition of external content into the processed document via the&[]()
marker.InsertSupExtension
to introduce underlined and superscript text.MarkdownInHtmlExtension
to parse and render Markdown located within HTML blocks.ScriptExtension
to includeJavaScript
content via the%[]()
marker.SuperFencesCodeExtension
to enhance the processing of fenced blocks.TableExtension
to render tables.TocExtension
to generate the table of contents and anchor the titles.
Front matter options (in valid YAML v1.1 format) are
extracted from any index.md
file via regular expression and properly parsed using
PyYAML
. Supported keys listed
below.
The whole front matter block (including ---
markers) is removed from the document
before processing it.
author
for thearticle:author
metatag;description
for theog:description
metatag;image
for theog:image
metatag (above 1200x650 pixels for high resolution screens);date
for thearticle:published_time
metatag (YYYY/MM/DD
format);tags
for thearticle:tag
metatag (list of keywords);title
for theog:title
metatag (defaults to the name of the folder otherwise);url
for theog:url
metatag;
Aside from title
, all metatags are left empty if absent from the front matter.
canonical
to provide the canonical link of the article (defaults tourl
if not provided).link
to provide a link to the author's favourite website.logo
to provide a top-bar logo.
Once generated, some extra rendering is done in the browser -i.e., on the client- via
a couple JavaScript
libraries:
highlight.js
for syntax highlighting.KaTeX
to render equations written in LaTeX.Mermaid
to render diagrams and flowcharts.
Run make serve
to get the HTTP server started at
http://localhost:8000/ using a niftily
patched
the tiny solution shipped with BusyBox,
thttpd
as a very lightweight solution for
local development and testing orhttpd
, although still
slightly bigger than the thttpd
solution previously used.