This site - adding more stuff
Moving some old content
Have migrated my Git workflow I created for school groups (formerly a Word document), and some of my notes from my computability theory class in undergrad (already in Markdown using pandoc + Mathjax).
Converting the Git document
First I used pandoc to convert my existing word document into markdown, and extract the images from the document into a directory. I manually divided the result into multiple pages, and experimented with using front matter to set links between the pages. The template front matter for each mage looks something like this:
---
title: Doing Work on a Task
series: Simple Git Workflow
tags: git
date: 2018-04-02
layout: layouts/git-workflow-article.njk
prev:
name: Starting a task
link: ../starting/
next:
name: Finishing a task
link: ../finishing/
---
Then in the Nunjucks layout, I extract the prev.link and next.link:
<div class="row">
</div>
It was tedious to set theses variables in every file. An improvement may be to use an 11ty directory data file to specify the list of pages, but I'm not sure yet how to use the file to drive page generation. I know I can use pagination, but I'd somehow have to import the contents of the appropriate markdown file for the current page and I'm not sure how to do that.
Alternately, I'm considering combining everything back into a single page, and having a sticky table of contents in the sidebar. Better user experience and likely less complicated.
Old class notes
My old class notes were written in pandoc markdown, which includes syntax extensions that markdown-it does not support by default. There were plugins for everything I needed, so my .eleventy.js
has expanded to configure a custom instance of markdown-it:
let markdownIt = require("markdown-it");
// https://github.com/markdown-it/markdown-it#init-with-presets-and-options
let options = {
html: true,
breaks: true,
linkify: true
};
// load mathjax plugin:
// https://www.npmjs.com/package/markdown-it-mathjax
let mathjax = require('markdown-it-mathjax');
// load pandoc-ish syntax extensions:
let sups = require('markdown-it-sup');
let subs = require('markdown-it-sub');
let footnotes = require('markdown-it-footnote');
eleventyConfig.setLibrary("md", markdownIt(options)
.use(mathjax())
.use(subs)
.use(sups)
.use(footnotes)
);
This was very simple to do by following 11ty's and markdown-it's documentation, and it worked the first time. The only other thing I had to change was to create a layout that pulls in MathJax.