diff options
author | Alexis Hovorka <[email protected]> | 2024-08-17 19:32:06 -0600 |
---|---|---|
committer | Alexis Hovorka <[email protected]> | 2024-08-17 19:32:06 -0600 |
commit | d2a685e50d20101a42b7d9d08d1b90bb92defcd3 (patch) | |
tree | 36d844396b638488f989aab9f2cba73b208fc0b2 /.eleventy.js | |
parent | f5890b7e14fd5c7d4aa11f089bfaf851a94a85a0 (diff) |
[feat] Yet more tweaks
Diffstat (limited to '.eleventy.js')
-rw-r--r-- | .eleventy.js | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/.eleventy.js b/.eleventy.js index 6cb78a0..e7794ce 100644 --- a/.eleventy.js +++ b/.eleventy.js @@ -55,8 +55,17 @@ module.exports = (cfg) => { const md = require("markdown-it")({ typographer: true, html: true, highlight: (str, lang) => { + let starting = 1; + let numLength; + if (lang.includes(":")) { + lang = lang.split(":"); + starting = lang[1]; + numLength = lang[2]; + lang = lang[0]; + } if (lang && hljs.getLanguage(lang)) { try { - return '<pre class="hljs"><code>' + + return '<pre class="hljs"><code'+(starting? + ' data-starting="'+starting+'"'+(numLength? ' data-num-length="'+numLength+'"' : '') : '')+'>' + hljs.highlight(str, { language: lang, ignoreIllegals: true }).value + '</code></pre>'; } catch (__) {} } @@ -66,6 +75,7 @@ module.exports = (cfg) => { }).use(require("markdown-it-anchor"), { permalink: true, permalinkBefore: true, permalinkSymbol: "#"}) .use(require("markdown-it-emoji"), {shortcuts: {}}) + .use(require("markdown-it-footnote")) .use(require("markdown-it-mark")); md.renderer.rules.emoji = (token, i) => @@ -74,6 +84,10 @@ module.exports = (cfg) => { md.renderer.rules.code_block = (tokens, i, options, env, slf) => `<pre${slf.renderAttrs(tokens[i])}><code>` + utils.escapeHtml(tokens[i].content.replace(/ /g, "\xA0"))+'</code></pre>\n'; + md.renderer.rules.footnote_block_open = () => ( + '<section class="footnotes">\n' + + '<ol class="footnotes-list">\n' + ); cfg.setLibrary("md", md); |