mirror of
https://github.com/helenclx/leilukin-site.git
synced 2025-04-01 20:50:51 +00:00
Compare commits
3 Commits
438b67469d
...
98fc3201d8
Author | SHA1 | Date | |
---|---|---|---|
|
98fc3201d8 | ||
|
8663ab10c5 | ||
|
26a8a967e9 |
@ -1,7 +1,7 @@
|
|||||||
import { DateTime } from "luxon";
|
import { DateTime } from "luxon";
|
||||||
|
|
||||||
export default function(eleventyConfig) {
|
export default function(eleventyConfig) {
|
||||||
// Filter contents by category
|
// Filter: Filter contents by category
|
||||||
eleventyConfig.addFilter("filterByCategory", function(contents, cat) {
|
eleventyConfig.addFilter("filterByCategory", function(contents, cat) {
|
||||||
cat = cat.toLowerCase();
|
cat = cat.toLowerCase();
|
||||||
let result = contents.filter(item => {
|
let result = contents.filter(item => {
|
||||||
@ -11,7 +11,7 @@ export default function(eleventyConfig) {
|
|||||||
return result;
|
return result;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Format dates
|
// Filter: Format dates
|
||||||
eleventyConfig.addFilter("formatDate", (date) => {
|
eleventyConfig.addFilter("formatDate", (date) => {
|
||||||
const dateFormat = "d LLLL yyyy";
|
const dateFormat = "d LLLL yyyy";
|
||||||
if (typeof date === "object") {
|
if (typeof date === "object") {
|
||||||
@ -20,12 +20,12 @@ export default function(eleventyConfig) {
|
|||||||
return DateTime.fromISO(date, { setZone: true }).toFormat(dateFormat);
|
return DateTime.fromISO(date, { setZone: true }).toFormat(dateFormat);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Limit number of items displayed
|
// Filter: Limit number of items displayed
|
||||||
eleventyConfig.addFilter("itemLimit", function(array, maximum) {
|
eleventyConfig.addFilter("itemLimit", function(array, maximum) {
|
||||||
return array.slice(0, maximum);
|
return array.slice(0, maximum);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Thousands separator
|
// Filter: Thousands separator
|
||||||
eleventyConfig.addFilter("thousands", function(num) {
|
eleventyConfig.addFilter("thousands", function(num) {
|
||||||
return num.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
return num.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
||||||
});
|
});
|
||||||
|
@ -2,10 +2,10 @@ import slugify from "slugify";
|
|||||||
import { markdownLibrary } from "./markdown-it.js";
|
import { markdownLibrary } from "./markdown-it.js";
|
||||||
|
|
||||||
export default function(eleventyConfig) {
|
export default function(eleventyConfig) {
|
||||||
// <cite> tag
|
// Shortcode: <cite> tag
|
||||||
eleventyConfig.addShortcode('cite', (str) => `<cite>${str}</cite>`);
|
eleventyConfig.addShortcode('cite', (str) => `<cite>${str}</cite>`);
|
||||||
|
|
||||||
// Manual heading anchor
|
// Shortcode: Manual heading anchor
|
||||||
eleventyConfig.addPairedShortcode('headingAnchor', (title, hLevel, id=slugify(title)) => {
|
eleventyConfig.addPairedShortcode('headingAnchor', (title, hLevel, id=slugify(title)) => {
|
||||||
return `<div class="heading-wrapper h${hLevel}">
|
return `<div class="heading-wrapper h${hLevel}">
|
||||||
<h${hLevel} id="${id}">${title}</h${hLevel}>
|
<h${hLevel} id="${id}">${title}</h${hLevel}>
|
||||||
@ -13,14 +13,14 @@ export default function(eleventyConfig) {
|
|||||||
</div>`;
|
</div>`;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Custom container
|
// Shortcode: Custom container
|
||||||
eleventyConfig.addPairedShortcode('container', (children, el, className) => {
|
eleventyConfig.addPairedShortcode('container', (children, el, className) => {
|
||||||
const classMarkup = className ? ` class="${className}"` : "";
|
const classMarkup = className ? ` class="${className}"` : "";
|
||||||
const content = markdownLibrary.render(children);
|
const content = markdownLibrary.render(children);
|
||||||
return `<${el}${classMarkup}>${content}</${el}>`;
|
return `<${el}${classMarkup}>${content}</${el}>`;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Image figure and figcaption
|
// Shortcode: Image figure and figcaption
|
||||||
eleventyConfig.addPairedShortcode('imgFigure', (
|
eleventyConfig.addPairedShortcode('imgFigure', (
|
||||||
caption, img, alt=caption, className, enableLazyLoading=true
|
caption, img, alt=caption, className, enableLazyLoading=true
|
||||||
) => {
|
) => {
|
||||||
@ -32,7 +32,7 @@ export default function(eleventyConfig) {
|
|||||||
</figure>`;
|
</figure>`;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Content disclosure
|
// Shortcode: Content disclosure
|
||||||
eleventyConfig.addPairedShortcode('disclosure', (content, summary) => {
|
eleventyConfig.addPairedShortcode('disclosure', (content, summary) => {
|
||||||
const summaryMarkup = markdownLibrary.renderInline(summary);
|
const summaryMarkup = markdownLibrary.renderInline(summary);
|
||||||
const contentMarkup = markdownLibrary.render(content);
|
const contentMarkup = markdownLibrary.render(content);
|
||||||
@ -42,7 +42,7 @@ export default function(eleventyConfig) {
|
|||||||
</details>`;
|
</details>`;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Paired shorcode: Content warning disclosure
|
// Shortcode: Content warning disclosure
|
||||||
eleventyConfig.addPairedShortcode('contentWarning', (content, warning) => {
|
eleventyConfig.addPairedShortcode('contentWarning', (content, warning) => {
|
||||||
const warningMarkup = markdownLibrary.renderInline(warning);
|
const warningMarkup = markdownLibrary.renderInline(warning);
|
||||||
const contentMarkup = markdownLibrary.render(content);
|
const contentMarkup = markdownLibrary.render(content);
|
||||||
|
@ -86,6 +86,7 @@
|
|||||||
|
|
||||||
img, picture, video, canvas {
|
img, picture, video, canvas {
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
|
height: auto;
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
title: Articles
|
title: Articles
|
||||||
date: 2024-07-03
|
date: 2024-07-03
|
||||||
updated: 2024-12-13T22:10:06+0800
|
updated: 2025-03-26T09:32:17+0800
|
||||||
toc: true
|
toc: true
|
||||||
---
|
---
|
||||||
|
|
||||||
@ -43,6 +43,10 @@ toc: true
|
|||||||
|
|
||||||
Nora Reed's website manifesto has been my go-to recommendated reading for why you should make your own website rather than relying on social media for your web presence.{.item-list__indent}
|
Nora Reed's website manifesto has been my go-to recommendated reading for why you should make your own website rather than relying on social media for your web presence.{.item-list__indent}
|
||||||
|
|
||||||
|
* [In Praise of Links](https://osteophage.neocities.org/writing/in-praise-of-links) by Coyote
|
||||||
|
|
||||||
|
Hyperlinks keep the web alive. This is also why link pages like this exist.{.item-list__indent}
|
||||||
|
|
||||||
* [The one app to read them all already exists, and it’s called RSS](https://journal.jatan.space/why-use-rss/) by Jatan Mehta
|
* [The one app to read them all already exists, and it’s called RSS](https://journal.jatan.space/why-use-rss/) by Jatan Mehta
|
||||||
|
|
||||||
I have been subscribing to RSS feeds since the 2000s to follow website and blog updates, and I encourage more internet users to do the same.
|
I have been subscribing to RSS feeds since the 2000s to follow website and blog updates, and I encourage more internet users to do the same.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user