Fix column overflow and render math with KaTeX
All checks were successful
Deploy to S3 / deploy (push) Successful in 1m41s
All checks were successful
Deploy to S3 / deploy (push) Successful in 1m41s
- minmax(0,1fr)+min-width:0 and pre-wrap so a long fenced line no longer blows out the grid - build-time KaTeX via @vscode/markdown-it-katex; ship katex CSS+fonts and link in layouts
This commit is contained in:
12
.eleventy.js
12
.eleventy.js
@@ -1,5 +1,6 @@
|
||||
const Image = require("@11ty/eleventy-img");
|
||||
const path = require("path");
|
||||
const markdownItKatex = require("@vscode/markdown-it-katex").default;
|
||||
|
||||
function imageShortcode(src, alt, sizes = "100vw") {
|
||||
const inputPath = path.join("img", src);
|
||||
@@ -54,6 +55,17 @@ module.exports = function (eleventyConfig) {
|
||||
eleventyConfig.addPassthroughCopy("img");
|
||||
eleventyConfig.addPassthroughCopy("favicon.svg");
|
||||
|
||||
// KaTeX: render $$...$$ at build time into static markup. Ship katex.min.css
|
||||
// plus its fonts/ as a sibling so the stylesheet's url(fonts/...) resolves.
|
||||
eleventyConfig.addPassthroughCopy({
|
||||
"node_modules/katex/dist/katex.min.css": "css/katex.min.css",
|
||||
"node_modules/katex/dist/fonts": "css/fonts",
|
||||
});
|
||||
|
||||
eleventyConfig.amendLibrary("md", (md) => {
|
||||
md.use(markdownItKatex, { throwOnError: false, errorColor: "#cc0000" });
|
||||
});
|
||||
|
||||
eleventyConfig.addShortcode("image", imageShortcode);
|
||||
eleventyConfig.addShortcode("heroImage", heroImageShortcode);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user