From d92bc06c5ab08beaef8d5a1e3a8ca3ad6a554588 Mon Sep 17 00:00:00 2001 From: saji Date: Mon, 14 Apr 2025 23:09:32 -0500 Subject: [PATCH] feeds --- _includes/layouts/base.njk | 26 +++------------------- _includes/layouts/post.njk | 1 + eleventy.config.js | 41 +++++++++++++++++++++------------- package-lock.json | 45 ++++++++++++++------------------------ package.json | 3 ++- 5 files changed, 49 insertions(+), 67 deletions(-) diff --git a/_includes/layouts/base.njk b/_includes/layouts/base.njk index eaf3980..db404b0 100644 --- a/_includes/layouts/base.njk +++ b/_includes/layouts/base.njk @@ -7,32 +7,12 @@ {#- Atom and JSON feeds included by default #} - + + - {#- Uncomment this if you’d like folks to know that you used Eleventy to build your site! #} - {#- #} - {#- - CSS bundles are provided via the `eleventy-plugin-bundle` plugin: - 1. You can add to them using `{% css %}` - 2. You can get from them using `{% getBundle "css" %}` or `{% getBundleFileUrl "css" %}` - 3. You can do the same for JS: {% js %}{% endjs %} and - 4. Learn more: https://github.com/11ty/eleventy-plugin-bundle - #} - - {#- Add an arbitrary string to the bundle #} - {%- css %}* { box-sizing: border-box; }{% endcss %} - {#- Add the contents of a file to the bundle #} - {%- css %}{% include "public/css/fonts.css"%} {% endcss %} - {%- css %}{% include "public/css/index.css" %}{% endcss %} - {#- Or add from node_modules #} - {# {%- css %}{% include "node_modules/prismjs/themes/prism-okaidia.css" %}{% endcss %} #} - - {#- Render the CSS bundle using Inlined CSS (for the fastest site performance in production) #} - - {#- Renders the CSS bundle using a separate file, if you can't set CSP directive style-src: 'unsafe-inline' #} - {#- #} + diff --git a/_includes/layouts/post.njk b/_includes/layouts/post.njk index 01d856a..f6eba17 100644 --- a/_includes/layouts/post.njk +++ b/_includes/layouts/post.njk @@ -4,6 +4,7 @@ layout: layouts/base.njk {# Only include the syntax highlighter CSS on blog posts #} {%- css "defer" %}{% include "node_modules/prismjs/themes/prism-okaidia.css" %}{% endcss %} {%- css "defer" %}{% include "public/css/prism-diff.css" %}{%- endcss %} +{# Only include the katex CSS on blog posts #} {%- css "defer" %}{% include "node_modules/katex/dist/katex.min.css" %}{% endcss %}

{{ title }}

diff --git a/eleventy.config.js b/eleventy.config.js index db1e794..473102d 100644 --- a/eleventy.config.js +++ b/eleventy.config.js @@ -1,10 +1,8 @@ import { DateTime } from "luxon"; import markdownItAnchor from "markdown-it-anchor"; import markdownItAbbr from "markdown-it-abbr/dist/markdown-it-abbr.js"; -import markdownItKatex from "@iktakahiro/markdown-it-katex"; -import markdownItRevealJs from "./markdown-it-revealjs.js"; +import markdownItKatex from "@vscode/markdown-it-katex"; -import pluginRss from "@11ty/eleventy-plugin-rss"; import { feedPlugin } from "@11ty/eleventy-plugin-rss"; import pluginSyntaxHighlight from "@11ty/eleventy-plugin-syntaxhighlight"; import pluginBundle from "@11ty/eleventy-plugin-bundle"; @@ -16,6 +14,7 @@ import { eleventyImageTransformPlugin } from "@11ty/eleventy-img"; import pluginDrafts from "./eleventy.config.drafts.js"; + /** @param {import('@11ty/eleventy').UserConfig} eleventyConfig */ export default async function (eleventyConfig) { // Copy the contents of the `public` folder to the output folder @@ -23,7 +22,7 @@ export default async function (eleventyConfig) { eleventyConfig.addPassthroughCopy({ "./public/": "/", "./node_modules/prismjs/themes/prism-okaidia.css": "/css/prism-okaidia.css", - "./node_modules/katex/dist/katex.min.css": "/css/katex.min.css", + "./node_modules/katex/dist/fonts/": "/bundle/fonts/", "./node_modules/reveal.js/dist/": "/revealjs/", "./node_modules/reveal.js/plugin/": "/revealjs-plugins/", }); @@ -38,16 +37,28 @@ export default async function (eleventyConfig) { eleventyConfig.addPlugin(pluginDrafts); // eleventyConfig.addPlugin(pluginFonts); // Official plugins - eleventyConfig.addPlugin(feedPlugin, { - collection: { - name: "posts", - limit: 0 - }, - metadata: { - title: "Musings", - base: "https://blog.saji.dev" - }, - }); + let mkFeed = function(type, path) { + eleventyConfig.addPlugin(feedPlugin, { + type: type, + outputPath: path, + collection: { + name: "posts", + limit: 0 + }, + metadata: { + title: "Musings", + base: "https://saji.dev", + language: "en", + + }, + }); + + + }; + mkFeed("rss", "/rss.feed.xml"); + mkFeed("atom", "/atom.feed.xml"); + mkFeed("json", "/feed.json"); + eleventyConfig.addPlugin(pluginSyntaxHighlight, { preAttributes: { tabindex: 0 } }); @@ -124,7 +135,7 @@ export default async function (eleventyConfig) { slugify: eleventyConfig.getFilter("slugify") }); mdLib.use(markdownItAbbr); - mdLib.use(markdownItKatex); + mdLib.use(markdownItKatex.default); }); eleventyConfig.addShortcode("currentBuildDate", () => { diff --git a/package-lock.json b/package-lock.json index 4cee6c1..1ccee7f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,9 +11,10 @@ "dependencies": { "@11ty/eleventy": "^3.0.0", "@11ty/eleventy-img": "^4.0.2", - "@iktakahiro/markdown-it-katex": "^4.0.1", + "@vscode/markdown-it-katex": "^1.1.1", "katex": "^0.16.22", "markdown-it-abbr": "^2.0.0", + "markdown-it-container": "^4.0.0", "reveal.js": "^5.2.1", "ttf2woff2": "^6.0.1" }, @@ -376,33 +377,6 @@ "tslib": "^2.4.0" } }, - "node_modules/@iktakahiro/markdown-it-katex": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/@iktakahiro/markdown-it-katex/-/markdown-it-katex-4.0.1.tgz", - "integrity": "sha512-kGFooO7fIOgY34PSG8ZNVsUlKhhNoqhzW2kq94TNGa8COzh73PO4KsEoPOsQVG1mEAe8tg7GqG0FoVao0aMHaw==", - "license": "MIT", - "dependencies": { - "katex": "^0.12.0" - } - }, - "node_modules/@iktakahiro/markdown-it-katex/node_modules/commander": { - "version": "2.20.3", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", - "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", - "license": "MIT" - }, - "node_modules/@iktakahiro/markdown-it-katex/node_modules/katex": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/katex/-/katex-0.12.0.tgz", - "integrity": "sha512-y+8btoc/CK70XqcHqjxiGWBOeIL8upbS0peTPXTvgrh21n1RiWWcIpSWM+4uXq+IAgNh9YYQWdc7LVDPDAEEAg==", - "license": "MIT", - "dependencies": { - "commander": "^2.19.0" - }, - "bin": { - "katex": "cli.js" - } - }, "node_modules/@img/sharp-darwin-arm64": { "version": "0.33.5", "resolved": "https://registry.npmjs.org/@img/sharp-darwin-arm64/-/sharp-darwin-arm64-0.33.5.tgz", @@ -913,6 +887,15 @@ "license": "MIT", "peer": true }, + "node_modules/@vscode/markdown-it-katex": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@vscode/markdown-it-katex/-/markdown-it-katex-1.1.1.tgz", + "integrity": "sha512-3KTlbsRBPJQLE2YmLL7K6nunTlU+W9T5+FjfNdWuIUKgxSS6HWLQHaO3L4MkJi7z7MpIPpY+g4N+cWNBPE/MSA==", + "license": "MIT", + "dependencies": { + "katex": "^0.16.4" + } + }, "node_modules/a-sync-waterfall": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/a-sync-waterfall/-/a-sync-waterfall-1.0.1.tgz", @@ -2413,6 +2396,12 @@ "markdown-it": "*" } }, + "node_modules/markdown-it-container": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/markdown-it-container/-/markdown-it-container-4.0.0.tgz", + "integrity": "sha512-HaNccxUH0l7BNGYbFbjmGpf5aLHAMTinqRZQAEQbMr2cdD3z91Q6kIo1oUn1CQndkT03jat6ckrdRYuwwqLlQw==", + "license": "MIT" + }, "node_modules/markdown-it/node_modules/entities": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", diff --git a/package.json b/package.json index e9f7515..80de56b 100644 --- a/package.json +++ b/package.json @@ -22,9 +22,10 @@ "dependencies": { "@11ty/eleventy": "^3.0.0", "@11ty/eleventy-img": "^4.0.2", - "@iktakahiro/markdown-it-katex": "^4.0.1", + "@vscode/markdown-it-katex": "^1.1.1", "katex": "^0.16.22", "markdown-it-abbr": "^2.0.0", + "markdown-it-container": "^4.0.0", "reveal.js": "^5.2.1", "ttf2woff2": "^6.0.1" },