Add Markdown footnotes

This commit is contained in:
Shadowfacts 2019-09-16 21:48:32 -04:00
parent eed3c335f2
commit 5d9ebd1a99
Signed by untrusted user: shadowfacts
GPG Key ID: 94A5AB95422746E5
4 changed files with 21 additions and 0 deletions

View File

@ -1,4 +1,5 @@
import MarkdownIt from "markdown-it"; import MarkdownIt from "markdown-it";
import MarkdownItFootnote from "markdown-it-footnote";
import slugify from "@sindresorhus/slugify"; import slugify from "@sindresorhus/slugify";
import * as util from "./util"; import * as util from "./util";
@ -8,6 +9,8 @@ const md = new MarkdownIt({
typographer: true typographer: true
}); });
md.use(MarkdownItFootnote);
// Inserts heading anchors // Inserts heading anchors
// Based on https://github.com/valeriangalliat/markdown-it-anchor // Based on https://github.com/valeriangalliat/markdown-it-anchor
md.core.ruler.push("anchor", (state) => { md.core.ruler.push("anchor", (state) => {

5
package-lock.json generated
View File

@ -1467,6 +1467,11 @@
"uc.micro": "^1.0.5" "uc.micro": "^1.0.5"
} }
}, },
"markdown-it-footnote": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/markdown-it-footnote/-/markdown-it-footnote-3.0.2.tgz",
"integrity": "sha512-JVW6fCmZWjvMdDQSbOT3nnOQtd9iAXmw7hTSh26+v42BnvXeVyGMDBm5b/EZocMed2MbCAHiTX632vY0FyGB8A=="
},
"mdurl": { "mdurl": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/mdurl/-/mdurl-1.0.1.tgz", "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-1.0.1.tgz",

View File

@ -26,6 +26,7 @@
"express": "^4.16.4", "express": "^4.16.4",
"highlight.js": "^9.13.1", "highlight.js": "^9.13.1",
"markdown-it": "^8.4.2", "markdown-it": "^8.4.2",
"markdown-it-footnote": "^3.0.2",
"morgan": "^1.9.1", "morgan": "^1.9.1",
"node-sass": "^4.12.0", "node-sass": "^4.12.0",
"pg": "^7.11.0", "pg": "^7.11.0",

View File

@ -101,6 +101,13 @@ article {
h1 { font-size: 1.8rem; } h1 { font-size: 1.8rem; }
h2 { font-size: 1.6rem; } h2 { font-size: 1.6rem; }
hr.footnotes-sep {
border: none;
height: 1px;
background: var(--accent-color);
}
// Markdown decorations
@media (min-width: 768px) { @media (min-width: 768px) {
a::before { content: "["; } a::before { content: "["; }
a::after { content: "](" attr(href) ")"; word-wrap: break-word; } a::after { content: "](" attr(href) ")"; word-wrap: break-word; }
@ -110,6 +117,11 @@ article {
font-size: 14px; font-size: 14px;
} }
a { text-decoration: none; } a { text-decoration: none; }
sup.footnote-ref > a::before,
sup.footnote-ref > a::after,
a.footnote-backref::before, a.footnote-backref::after {
content: "";
}
} }
code::before, code::after { code::before, code::after {
content: "`"; content: "`";