diff --git a/.eleventy.js b/.eleventy.js index af50c81..12dfdd5 100644 --- a/.eleventy.js +++ b/.eleventy.js @@ -1,7 +1,12 @@ +const eleventyPluginToc = require("eleventy-plugin-toc") +const markdownIt = require("markdown-it") +const markdownItAnchor = require("markdown-it-anchor") + + module.exports = (eleventyConfig) => { - eleventyConfig.addFilter("isoDate", dateObj => { - return dateObj.toISOString().substr(0, 10); - }); + eleventyConfig.addFilter("isoDate", it => it.toISOString().substring(0, 10)); + eleventyConfig.addPlugin(eleventyPluginToc, {tags: ["h2", "h3"], wrapper: "div"}); + eleventyConfig.setLibrary("md", markdownIt().use(markdownItAnchor)); return { pathPrefix: "/blog/", diff --git a/package-lock.json b/package-lock.json index 0fc5535..31b2688 100644 Binary files a/package-lock.json and b/package-lock.json differ diff --git a/package.json b/package.json index 9f5a8b2..a6815d0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "blog", - "version": "1.3.1", + "version": "1.4.0", "description": "Florine's personal blog.", "author": "Florine W. Dekker", "browser": "dist/bundle.js", @@ -16,7 +16,8 @@ "deploy": "grunt deploy" }, "devDependencies": { - "@11ty/eleventy": "^1.0.1", + "@11ty/eleventy": "^1.0.2", + "eleventy-plugin-toc": "^1.1.5", "grunt": "^1.5.3", "grunt-cli": "^1.4.3", "grunt-contrib-clean": "^2.0.1", @@ -24,6 +25,8 @@ "grunt-contrib-watch": "^1.1.0", "grunt-exec": "^3.0.0", "grunt-focus": "^1.0.0", - "grunt-text-replace": "^0.4.0" + "grunt-text-replace": "^0.4.0", + "markdown-it": "^13.0.1", + "markdown-it-anchor": "^8.6.5" } } diff --git a/src/main/_includes/post.njk b/src/main/_includes/post.njk index 66bb882..f4536bc 100644 --- a/src/main/_includes/post.njk +++ b/src/main/_includes/post.njk @@ -5,7 +5,10 @@ layout: default

← home

- +
+
+
+

{{ title }}

{% if date %}{{ date | isoDate }}{% endif %} @@ -15,4 +18,12 @@ layout: default ← home
+ {% if content | toc %} +
+
+

Contents

+ {{ content | toc | safe }} +
+
+ {% endif %}
diff --git a/src/main/_posts/2017-03-01-raspi.md b/src/main/_posts/2017-03-01-raspi.md index d8ba743..8012ab0 100644 --- a/src/main/_posts/2017-03-01-raspi.md +++ b/src/main/_posts/2017-03-01-raspi.md @@ -76,7 +76,7 @@ Example output will be given directly after it in a separate code block. 3. Enjoy! -### Disconnecting +### 2.1 Disconnecting To unmount the Raspi: $ umount /mnt/raspi diff --git a/src/main/css/main.css b/src/main/css/main.css index 1a1c7bf..725a84c 100644 --- a/src/main/css/main.css +++ b/src/main/css/main.css @@ -1,7 +1,8 @@ -#contents .container { - max-width: 80rem; +#innerBody { + max-width: 75rem; } + p { text-align: justify !important; text-justify: inter-word !important; @@ -11,6 +12,16 @@ ol { list-style: decimal outside !important; } + +#toc { + position: fixed; +} + +#toc ol { + list-style-type: none !important; +} + + .inline-header { display: inline-block;