const pluginWebc = require("@11ty/eleventy-plugin-webc"); module.exports = function(eleventyConfig) { eleventyConfig.ignores.add("README.md"); eleventyConfig.addPlugin(pluginWebc); eleventyConfig.addWatchTarget("../src/activitypub-tests/**/*.md") eleventyConfig.setServerOptions({ domDiff: false }); eleventyConfig.addPassthroughCopy({ "../README.md": "README.md" }) eleventyConfig.addPassthroughCopy({ "../node_modules/markdown-it": "node_modules/markdown-it" }) // eleventyConfig.setServerPassthroughCopyBehavior("passthrough") withMarkdownFilters(eleventyConfig) return {} }; function withMarkdownFilters(eleventyConfig) { eleventyConfig.addFilter('withoutMarkdownFrontMatter', withoutMarkdownFrontMatter) } /** * if the provided markdown has yaml front matter[0], return a version of the markdown that omits it * @param markdown * @returns {string} */ function withoutMarkdownFrontMatter(markdown) { const sections = (markdown ?? '').split('---').map((s => s.trim())).flatMap(s => s ? [s] : []) if (sections.length <= 1) return markdown || '' // the '\n' preceding is required for

to not get mangled const markdownSansFront = ['\n', sections.slice(1).join('---')].join('') return markdownSansFront }