1
0
Fork 0
This commit is contained in:
saji 2025-04-14 23:09:32 -05:00
parent e25d3faaf5
commit d92bc06c5a
5 changed files with 49 additions and 67 deletions

View file

@ -7,32 +7,12 @@
<meta name="description" content="{{ description or metadata.description }}"> <meta name="description" content="{{ description or metadata.description }}">
{#- Atom and JSON feeds included by default #} {#- Atom and JSON feeds included by default #}
<link rel="alternate" href="/feed.xml" type="application/atom+xml" title="{{ metadata.title }}"> <link rel="alternate" href="/atom.feed.xml" type="application/atom+xml" title="{{ metadata.title }}">
<link rel="alternate" href="/rss.feed.xml" type="application/rss+xml" title="{{ metadata.title }}">
<link rel="alternate" href="/feed.json" type="application/json" title="{{ metadata.title }}"> <link rel="alternate" href="/feed.json" type="application/json" title="{{ metadata.title }}">
{#- Uncomment this if youd like folks to know that you used Eleventy to build your site! #}
{#- <meta name="generator" content="{{ eleventy.generator }}"> #}
{#- <link rel="stylesheet" href="{% getBundleFileUrl "css" %}">
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 <script>{% getBundle "js" %}</script>
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) #}
<style>{% getBundle "css" %}</style>
{#- Renders the CSS bundle using a separate file, if you can't set CSP directive style-src: 'unsafe-inline' #}
{#- <link rel="stylesheet" href="{% getBundleFileUrl "css" %}"> #}
<link rel="stylesheet" href="{% getBundleFileUrl "css", "defer" %}"> <link rel="stylesheet" href="{% getBundleFileUrl "css", "defer" %}">
</head> </head>
<body> <body>

View file

@ -4,6 +4,7 @@ layout: layouts/base.njk
{# Only include the syntax highlighter CSS on blog posts #} {# Only include the syntax highlighter CSS on blog posts #}
{%- css "defer" %}{% include "node_modules/prismjs/themes/prism-okaidia.css" %}{% endcss %} {%- css "defer" %}{% include "node_modules/prismjs/themes/prism-okaidia.css" %}{% endcss %}
{%- css "defer" %}{% include "public/css/prism-diff.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 %} {%- css "defer" %}{% include "node_modules/katex/dist/katex.min.css" %}{% endcss %}
<h1>{{ title }}</h1> <h1>{{ title }}</h1>

View file

@ -1,10 +1,8 @@
import { DateTime } from "luxon"; import { DateTime } from "luxon";
import markdownItAnchor from "markdown-it-anchor"; import markdownItAnchor from "markdown-it-anchor";
import markdownItAbbr from "markdown-it-abbr/dist/markdown-it-abbr.js"; import markdownItAbbr from "markdown-it-abbr/dist/markdown-it-abbr.js";
import markdownItKatex from "@iktakahiro/markdown-it-katex"; import markdownItKatex from "@vscode/markdown-it-katex";
import markdownItRevealJs from "./markdown-it-revealjs.js";
import pluginRss from "@11ty/eleventy-plugin-rss";
import { feedPlugin } from "@11ty/eleventy-plugin-rss"; import { feedPlugin } from "@11ty/eleventy-plugin-rss";
import pluginSyntaxHighlight from "@11ty/eleventy-plugin-syntaxhighlight"; import pluginSyntaxHighlight from "@11ty/eleventy-plugin-syntaxhighlight";
import pluginBundle from "@11ty/eleventy-plugin-bundle"; import pluginBundle from "@11ty/eleventy-plugin-bundle";
@ -16,6 +14,7 @@ import { eleventyImageTransformPlugin } from "@11ty/eleventy-img";
import pluginDrafts from "./eleventy.config.drafts.js"; import pluginDrafts from "./eleventy.config.drafts.js";
/** @param {import('@11ty/eleventy').UserConfig} eleventyConfig */ /** @param {import('@11ty/eleventy').UserConfig} eleventyConfig */
export default async function (eleventyConfig) { export default async function (eleventyConfig) {
// Copy the contents of the `public` folder to the output folder // Copy the contents of the `public` folder to the output folder
@ -23,7 +22,7 @@ export default async function (eleventyConfig) {
eleventyConfig.addPassthroughCopy({ eleventyConfig.addPassthroughCopy({
"./public/": "/", "./public/": "/",
"./node_modules/prismjs/themes/prism-okaidia.css": "/css/prism-okaidia.css", "./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/dist/": "/revealjs/",
"./node_modules/reveal.js/plugin/": "/revealjs-plugins/", "./node_modules/reveal.js/plugin/": "/revealjs-plugins/",
}); });
@ -38,16 +37,28 @@ export default async function (eleventyConfig) {
eleventyConfig.addPlugin(pluginDrafts); eleventyConfig.addPlugin(pluginDrafts);
// eleventyConfig.addPlugin(pluginFonts); // eleventyConfig.addPlugin(pluginFonts);
// Official plugins // Official plugins
let mkFeed = function(type, path) {
eleventyConfig.addPlugin(feedPlugin, { eleventyConfig.addPlugin(feedPlugin, {
type: type,
outputPath: path,
collection: { collection: {
name: "posts", name: "posts",
limit: 0 limit: 0
}, },
metadata: { metadata: {
title: "Musings", title: "Musings",
base: "https://blog.saji.dev" base: "https://saji.dev",
language: "en",
}, },
}); });
};
mkFeed("rss", "/rss.feed.xml");
mkFeed("atom", "/atom.feed.xml");
mkFeed("json", "/feed.json");
eleventyConfig.addPlugin(pluginSyntaxHighlight, { eleventyConfig.addPlugin(pluginSyntaxHighlight, {
preAttributes: { tabindex: 0 } preAttributes: { tabindex: 0 }
}); });
@ -124,7 +135,7 @@ export default async function (eleventyConfig) {
slugify: eleventyConfig.getFilter("slugify") slugify: eleventyConfig.getFilter("slugify")
}); });
mdLib.use(markdownItAbbr); mdLib.use(markdownItAbbr);
mdLib.use(markdownItKatex); mdLib.use(markdownItKatex.default);
}); });
eleventyConfig.addShortcode("currentBuildDate", () => { eleventyConfig.addShortcode("currentBuildDate", () => {

45
package-lock.json generated
View file

@ -11,9 +11,10 @@
"dependencies": { "dependencies": {
"@11ty/eleventy": "^3.0.0", "@11ty/eleventy": "^3.0.0",
"@11ty/eleventy-img": "^4.0.2", "@11ty/eleventy-img": "^4.0.2",
"@iktakahiro/markdown-it-katex": "^4.0.1", "@vscode/markdown-it-katex": "^1.1.1",
"katex": "^0.16.22", "katex": "^0.16.22",
"markdown-it-abbr": "^2.0.0", "markdown-it-abbr": "^2.0.0",
"markdown-it-container": "^4.0.0",
"reveal.js": "^5.2.1", "reveal.js": "^5.2.1",
"ttf2woff2": "^6.0.1" "ttf2woff2": "^6.0.1"
}, },
@ -376,33 +377,6 @@
"tslib": "^2.4.0" "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": { "node_modules/@img/sharp-darwin-arm64": {
"version": "0.33.5", "version": "0.33.5",
"resolved": "https://registry.npmjs.org/@img/sharp-darwin-arm64/-/sharp-darwin-arm64-0.33.5.tgz", "resolved": "https://registry.npmjs.org/@img/sharp-darwin-arm64/-/sharp-darwin-arm64-0.33.5.tgz",
@ -913,6 +887,15 @@
"license": "MIT", "license": "MIT",
"peer": true "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": { "node_modules/a-sync-waterfall": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/a-sync-waterfall/-/a-sync-waterfall-1.0.1.tgz", "resolved": "https://registry.npmjs.org/a-sync-waterfall/-/a-sync-waterfall-1.0.1.tgz",
@ -2413,6 +2396,12 @@
"markdown-it": "*" "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": { "node_modules/markdown-it/node_modules/entities": {
"version": "4.5.0", "version": "4.5.0",
"resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz",

View file

@ -22,9 +22,10 @@
"dependencies": { "dependencies": {
"@11ty/eleventy": "^3.0.0", "@11ty/eleventy": "^3.0.0",
"@11ty/eleventy-img": "^4.0.2", "@11ty/eleventy-img": "^4.0.2",
"@iktakahiro/markdown-it-katex": "^4.0.1", "@vscode/markdown-it-katex": "^1.1.1",
"katex": "^0.16.22", "katex": "^0.16.22",
"markdown-it-abbr": "^2.0.0", "markdown-it-abbr": "^2.0.0",
"markdown-it-container": "^4.0.0",
"reveal.js": "^5.2.1", "reveal.js": "^5.2.1",
"ttf2woff2": "^6.0.1" "ttf2woff2": "^6.0.1"
}, },