├── .gitignore
├── src
├── _includes
│ ├── layouts
│ │ ├── base.njk
│ │ └── page.njk
│ └── header.njk
├── home.njk
├── about.njk
└── contact.html
├── www
├── about
│ └── index.html
├── home
│ └── index.html
└── contact
│ └── index.html
├── package.json
└── .eleventy.js
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 |
--------------------------------------------------------------------------------
/src/_includes/layouts/base.njk:
--------------------------------------------------------------------------------
1 | {{ content | safe }}
2 |
--------------------------------------------------------------------------------
/src/_includes/header.njk:
--------------------------------------------------------------------------------
1 | {{ title }}
3 |
Here, I write a {{ title }} introduction or whatever…
11 |12 | {{ description | md | safe }} 13 |14 | {% endblock %} 15 | 16 | {% block snippet2 %} 17 |
Continuing the {{ title }} writing, I wax on, poetically, of course…
18 | 19 | {% md %} 20 | This is some *markdown*, now with __things__! 21 | 22 | 1. one 23 | 1. two 24 | 1. three 25 | 26 | - unordered 1 27 | - unordered 2 28 | 29 |  30 | {% endmd %} 31 | {% endblock %} 32 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "11ty-blocks-extends", 3 | "description": "Nunjucks blocks in Eleventy", 4 | "version": "1.0.0", 5 | "author": "", 6 | "bugs": { 7 | "url": "https://github.com/pdehaan/11ty-blocks-extends/issues" 8 | }, 9 | "dependencies": { 10 | "@11ty/eleventy": "^0.12.1", 11 | "dedent": "^0.7.0", 12 | "del": "^6.0.0" 13 | }, 14 | "devDependencies": { 15 | "prettier": "^2.3.2" 16 | }, 17 | "homepage": "https://github.com/pdehaan/11ty-blocks-extends#readme", 18 | "keywords": [], 19 | "license": "ISC", 20 | "main": "index.js", 21 | "repository": { 22 | "type": "git", 23 | "url": "git+https://github.com/pdehaan/11ty-blocks-extends.git" 24 | }, 25 | "scripts": { 26 | "build": "eleventy", 27 | "pretty:www": "prettier www --write" 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /.eleventy.js: -------------------------------------------------------------------------------- 1 | const del = require("del").sync; 2 | const dedent = require("dedent"); 3 | const markdownIt = require("markdown-it"); 4 | 5 | module.exports = function (eleventyConfig) { 6 | // Purge the `output` directory. 7 | del("./www"); 8 | 9 | const markdownLib = markdownIt({ 10 | html: true, 11 | linkify: true, 12 | typographer: true, 13 | }).disable("code"); 14 | eleventyConfig.setLibrary("md", markdownLib); 15 | 16 | eleventyConfig.addFilter("md", (text) => markdownLib.render(dedent(text))); 17 | eleventyConfig.addPairedShortcode("md", eleventyConfig.getFilter("md")); 18 | 19 | return { 20 | dataTemplateEngine: "njk", 21 | markdownTemplateEngine: "njk", 22 | htmlTemplateEngine: "njk", 23 | templateFormats: ["njk", "html"], 24 | 25 | dir: { 26 | input: "src", 27 | output: "www", 28 | }, 29 | }; 30 | }; 31 | -------------------------------------------------------------------------------- /www/contact/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |Here, I write a CoNtAcT introduction or whatever…
16 |17 |20 | 21 | 22 |Check out https://11ty.dev for more great tips!
18 | 19 |
Continuing the CoNtAcT writing, I wax on, poetically, of course…
25 | 26 |This is some markdown, now with things!
27 |