mirror of
https://github.com/danog/sass-site.git
synced 2024-11-27 04:24:50 +01:00
c0075a337a
* main: Add docs on templates lint revert to shorthand nesting padding for now Quick negative css variables over using calc repeatedly Use {% render %} instead of deprecated {% include %} Do not auto-typogr for markdown Add alerts.yml data file More consistent use of typogr for all contents
78 lines
2.1 KiB
JavaScript
78 lines
2.1 KiB
JavaScript
'use strict';
|
|
|
|
const { EleventyRenderPlugin } = require('@11ty/eleventy');
|
|
const syntaxHighlight = require('@11ty/eleventy-plugin-syntaxhighlight');
|
|
const formatDistanceToNow = require('date-fns/formatDistanceToNow');
|
|
const yaml = require('js-yaml');
|
|
const markdown = require('markdown-it');
|
|
const markdownDefList = require('markdown-it-deflist');
|
|
const typogrify = require('typogr');
|
|
|
|
/** @param {import('@11ty/eleventy').UserConfig} eleventyConfig */
|
|
module.exports = (eleventyConfig) => {
|
|
eleventyConfig.addPassthroughCopy('source/assets/dist');
|
|
eleventyConfig.addPassthroughCopy('source/assets/img');
|
|
eleventyConfig.addPassthroughCopy('source/favicon.ico');
|
|
|
|
eleventyConfig.setLiquidOptions({
|
|
jsTruthy: true,
|
|
});
|
|
eleventyConfig.setUseGitIgnore(false);
|
|
|
|
const mdown = markdown({
|
|
html: true,
|
|
typographer: true,
|
|
}).use(markdownDefList);
|
|
|
|
eleventyConfig.setLibrary('md', mdown);
|
|
eleventyConfig.addDataExtension('yml, yaml', (contents) =>
|
|
yaml.load(contents),
|
|
);
|
|
|
|
// Paired shortcodes...
|
|
eleventyConfig.addPairedLiquidShortcode('markdown', (content) =>
|
|
mdown.render(content),
|
|
);
|
|
|
|
eleventyConfig.addPairedLiquidShortcode('markdownInline', (content) =>
|
|
mdown.renderInline(content),
|
|
);
|
|
|
|
eleventyConfig.addPairedLiquidShortcode('typogr', (content) =>
|
|
typogrify.typogrify(content),
|
|
);
|
|
|
|
// Filters...
|
|
eleventyConfig.addLiquidFilter('formatDistanceToNow', (date) => {
|
|
return formatDistanceToNow(new Date(date));
|
|
});
|
|
|
|
eleventyConfig.addLiquidFilter('markdown', (content) =>
|
|
mdown.render(content),
|
|
);
|
|
|
|
eleventyConfig.addLiquidFilter('markdownInline', (content) =>
|
|
mdown.renderInline(content),
|
|
);
|
|
|
|
eleventyConfig.addLiquidFilter('typogr', (content) =>
|
|
typogrify.typogrify(content),
|
|
);
|
|
|
|
eleventyConfig.addLiquidFilter('isTypedoc', (page) =>
|
|
page.url.startsWith('/documentation/js-api/'),
|
|
);
|
|
|
|
eleventyConfig.addPlugin(EleventyRenderPlugin);
|
|
eleventyConfig.addPlugin(syntaxHighlight);
|
|
|
|
// settings
|
|
return {
|
|
dir: {
|
|
input: 'source',
|
|
includes: '_includes',
|
|
layouts: '_layouts',
|
|
},
|
|
};
|
|
};
|