Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 11 additions & 16 deletions .eleventy.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
const slugify = require("@sindresorhus/slugify");
const slugify = require("slugify");
const markdownIt = require("markdown-it");
const fs = require("fs");
const matter = require("gray-matter");
// Obsidian writes [[Page\|Alias]] in frontmatter, but \| is an invalid YAML
// escape sequence. This custom engine strips \| before parsing. Shared between
// Eleventy's own frontmatter parser and the manual matter() call in
// getAnchorAttributes so that wikilink resolution can read the permalink.
const jsYamlForMatter = require(require.resolve("js-yaml", { paths: [require.resolve("gray-matter")] }));
const jsYamlForMatter = require("js-yaml")
const matterOptions = {
engines: {
yaml: {
Expand All @@ -23,8 +23,7 @@ const FAVICON_NORMALIZED = "./.cache/favicon.normalized.svg";
normalizeFavicon(FAVICON_SOURCE, FAVICON_NORMALIZED);
const tocPlugin = require("eleventy-plugin-nesting-toc");
const { parse } = require("node-html-parser");
const htmlMinifier = require("html-minifier-terser");
const pluginRss = require("@11ty/eleventy-plugin-rss");
const { minifyProductionHtml } = require("./src/site/minify-html.js");

const { headerToId, namedHeadingsFilter } = require("./src/helpers/utils");
const {
Expand Down Expand Up @@ -118,7 +117,12 @@ const tagRegex = /(^|\s|\>)(#[^\s!@#$%^&*()=+\.,\[{\]};:'"?><]+)(?!([^<]*>))/g;
const markdownFileTypeRegex = /\.(md|markdown)$/i;
const isMarkdownPage = (inputPath) => inputPath && inputPath.match(markdownFileTypeRegex);

module.exports = function(eleventyConfig) {
module.exports = async function(eleventyConfig) {
const pluginRssModule = await import("@11ty/eleventy-plugin-rss");
const pluginRss = pluginRssModule.default || pluginRssModule;
const mathjax3Module = await import("markdown-it-mathjax3");
const mathjax3 = mathjax3Module.default || mathjax3Module;

eleventyConfig.setLiquidOptions({
dynamicPartials: true,
});
Expand All @@ -139,7 +143,7 @@ module.exports = function(eleventyConfig) {
return '<a class="tag" onclick="toggleTagSearch(this)">';
};
})
.use(require("markdown-it-mathjax3"), {
.use(mathjax3, {
tex: {
inlineMath: [["$", "$"]],
},
Expand Down Expand Up @@ -682,16 +686,7 @@ module.exports = function(eleventyConfig) {
(this.page.outputPath || "").endsWith(".html")
) {
try {
return await htmlMinifier.minify(content, {
useShortDoctype: true,
removeComments: true,
collapseWhitespace: true,
conservativeCollapse: true,
preserveLineBreaks: true,
minifyCSS: true,
minifyJS: true,
keepClosingSlash: true,
});
return await minifyProductionHtml(content);
} catch {
// If the html minifying fails for some reason due to some malformed text, just return the content as is.
return content;
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:

strategy:
matrix:
node-version: [20.x]
node-version: [22.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
Expand Down
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodejs 22.12.0
Loading