Configure markdown-it-footnote
This commit is contained in:
parent
31b6d5968b
commit
96a0ba2b42
@ -82,6 +82,17 @@ module.exports = function (eleventyConfig) {
|
|||||||
'<ol class="footnotes-list">\n'
|
'<ol class="footnotes-list">\n'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const renderRules = {
|
||||||
|
footnote_caption: ['[', '[<span class="visually-hidden">Footnote </span>'],
|
||||||
|
footnote_anchor: ['<a', '<a aria-label="Back to content"'],
|
||||||
|
};
|
||||||
|
Object.keys(renderRules).map(rule => {
|
||||||
|
let defaultRender = markdownLibrary.renderer.rules[rule];
|
||||||
|
markdownLibrary.renderer.rules[rule] = (tokens, idx, options, env, self) => {
|
||||||
|
return defaultRender(tokens, idx, options, env, self).replace(...renderRules[rule]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// Paired shortcode: custom container
|
// Paired shortcode: custom container
|
||||||
eleventyConfig.addPairedShortcode('container', (children, el, className) => {
|
eleventyConfig.addPairedShortcode('container', (children, el, className) => {
|
||||||
const classMarkup = className ? ` class="${className}"` : "";
|
const classMarkup = className ? ` class="${className}"` : "";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user