├── .gitignore
├── src
├── markdown.md
└── nunjucks.njk
├── www
├── markdown
│ └── index.html
└── nunjucks
│ └── index.html
├── package.json
└── eleventy.config.js
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 |
--------------------------------------------------------------------------------
/src/markdown.md:
--------------------------------------------------------------------------------
1 | And here is [my body link](https://foo.bar){target="_blank"}
2 |
--------------------------------------------------------------------------------
/www/markdown/index.html:
--------------------------------------------------------------------------------
1 |
And here is my body link
2 |
--------------------------------------------------------------------------------
/www/nunjucks/index.html:
--------------------------------------------------------------------------------
1 |
6 |
7 |
10 |
--------------------------------------------------------------------------------
/src/nunjucks.njk:
--------------------------------------------------------------------------------
1 | ---
2 | item: 'This is [my frontmatter link](https://foo.bar){target="_blank"}'
3 | ---
4 |
5 |
6 | {%- markdown %}{{ item | safe }}{% endmarkdown -%}
7 |
8 |
9 |
10 | {%- markdown true %}{{ item | safe }}{% endmarkdown -%}
11 |
12 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "11ty-2301",
3 | "description": "",
4 | "version": "1.0.0",
5 | "author": "Peter deHaan ",
6 | "bugs": {
7 | "url": "https://github.com/pdehaan/11ty-2301/issues"
8 | },
9 | "dependencies": {
10 | "@11ty/eleventy": "^2.0.1",
11 | "markdown-it": "^13.0.2",
12 | "markdown-it-attrs": "^4.1.6"
13 | },
14 | "devDependencies": {},
15 | "homepage": "https://github.com/pdehaan/11ty-2301#readme",
16 | "keywords": [],
17 | "license": "MPL-2.0",
18 | "main": "index.js",
19 | "repository": {
20 | "type": "git",
21 | "url": "git+https://github.com/pdehaan/11ty-2301.git"
22 | },
23 | "scripts": {
24 | "build": "eleventy",
25 | "test": "echo \"Error: no test specified\" && exit 1"
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/eleventy.config.js:
--------------------------------------------------------------------------------
1 | const markdownLib = require("markdown-it")({ html: true });
2 | const mdAttrs = require("markdown-it-attrs");
3 |
4 | /**
5 | * @param {import("@11ty/eleventy/src/UserConfig")} eleventyConfig
6 | * @returns {ReturnType}
7 | */
8 | module.exports = function (eleventyConfig) {
9 | // markdownLib.use(mdAttrs);
10 | eleventyConfig.setLibrary("md", markdownLib);
11 | eleventyConfig.amendLibrary("md", (markdownLib) => markdownLib.use(mdAttrs));
12 |
13 | eleventyConfig.addPairedShortcode("markdown", (content, inline = null) => {
14 | return inline
15 | ? markdownLib.renderInline(content)
16 | : markdownLib.render(content);
17 | });
18 |
19 | return {
20 | dir: {
21 | input: "src",
22 | output: "www",
23 | },
24 | };
25 | };
26 |
--------------------------------------------------------------------------------