This commit is contained in:
Amir Pourmand 2025-12-08 10:16:01 +00:00 committed by GitHub
commit 7b523692cd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
32 changed files with 134 additions and 0 deletions

View File

@ -68,6 +68,7 @@ const config: QuartzConfig = {
}),
Plugin.ObsidianFlavoredMarkdown({ enableInHtmlEmbed: false }),
Plugin.GitHubFlavoredMarkdown(),
Plugin.LocalizedFootnotes(),
Plugin.TableOfContents(),
Plugin.CrawlLinks({ markdownLinkResolution: "shortest" }),
Plugin.Description(),

View File

@ -65,6 +65,9 @@ export default {
? `دقيقتان للقراءة`
: `${minutes} دقائق للقراءة`,
},
footnotes: {
title: "الحواشي",
},
},
pages: {
rss: {

View File

@ -59,6 +59,9 @@ export default {
contentMeta: {
readingTime: ({ minutes }) => `Es llegeix en ${minutes} min`,
},
footnotes: {
title: "Notes a peu de pàgina",
},
},
pages: {
rss: {

View File

@ -59,6 +59,9 @@ export default {
contentMeta: {
readingTime: ({ minutes }) => `${minutes} min čtení`,
},
footnotes: {
title: "Poznámky pod čarou",
},
},
pages: {
rss: {

View File

@ -59,6 +59,9 @@ export default {
contentMeta: {
readingTime: ({ minutes }) => `${minutes} Min. Lesezeit`,
},
footnotes: {
title: "Fußnoten",
},
},
pages: {
rss: {

View File

@ -62,6 +62,9 @@ export interface Translation {
contentMeta: {
readingTime: (variables: { minutes: number }) => string
}
footnotes: {
title: string
}
}
pages: {
rss: {

View File

@ -59,6 +59,9 @@ export default {
contentMeta: {
readingTime: ({ minutes }) => `${minutes} min read`,
},
footnotes: {
title: "Footnotes",
},
},
pages: {
rss: {

View File

@ -59,6 +59,9 @@ export default {
contentMeta: {
readingTime: ({ minutes }) => `${minutes} min read`,
},
footnotes: {
title: "Footnotes",
},
},
pages: {
rss: {

View File

@ -59,6 +59,9 @@ export default {
contentMeta: {
readingTime: ({ minutes }) => `Se lee en ${minutes} min`,
},
footnotes: {
title: "Notas al pie",
},
},
pages: {
rss: {

View File

@ -60,6 +60,9 @@ export default {
contentMeta: {
readingTime: ({ minutes }) => `زمان تقریبی مطالعه: ${minutes} دقیقه`,
},
footnotes: {
title: "پاورقی‌ها",
},
},
pages: {
rss: {

View File

@ -59,6 +59,9 @@ export default {
contentMeta: {
readingTime: ({ minutes }) => `${minutes} min lukuaika`,
},
footnotes: {
title: "Alaviitteet",
},
},
pages: {
rss: {

View File

@ -59,6 +59,9 @@ export default {
contentMeta: {
readingTime: ({ minutes }) => `${minutes} min de lecture`,
},
footnotes: {
title: "Notes de bas de page",
},
},
pages: {
rss: {

View File

@ -59,6 +59,9 @@ export default {
contentMeta: {
readingTime: ({ minutes }) => `${minutes} perces olvasás`,
},
footnotes: {
title: "Lábjegyzetek",
},
},
pages: {
rss: {

View File

@ -59,6 +59,9 @@ export default {
contentMeta: {
readingTime: ({ minutes }) => `${minutes} menit baca`,
},
footnotes: {
title: "Catatan kaki",
},
},
pages: {
rss: {

View File

@ -60,6 +60,9 @@ export default {
contentMeta: {
readingTime: ({ minutes }) => (minutes === 1 ? "1 minuto" : `${minutes} minuti`),
},
footnotes: {
title: "Note a piè di pagina",
},
},
pages: {
rss: {

View File

@ -59,6 +59,9 @@ export default {
contentMeta: {
readingTime: ({ minutes }) => `${minutes} min read`,
},
footnotes: {
title: "脚注",
},
},
pages: {
rss: {

View File

@ -59,6 +59,9 @@ export default {
contentMeta: {
readingTime: ({ minutes }) => `${minutes} min read`,
},
footnotes: {
title: "각주",
},
},
pages: {
rss: {

View File

@ -59,6 +59,9 @@ export default {
contentMeta: {
readingTime: ({ minutes }) => `${minutes} min skaitymo`,
},
footnotes: {
title: "Išnašos",
},
},
pages: {
rss: {

View File

@ -59,6 +59,9 @@ export default {
contentMeta: {
readingTime: ({ minutes }) => `${minutes} min lesning`,
},
footnotes: {
title: "Fotnoter",
},
},
pages: {
rss: {

View File

@ -60,6 +60,9 @@ export default {
readingTime: ({ minutes }) =>
minutes === 1 ? "1 minuut leestijd" : `${minutes} minuten leestijd`,
},
footnotes: {
title: "Voetnoten",
},
},
pages: {
rss: {

View File

@ -59,6 +59,9 @@ export default {
contentMeta: {
readingTime: ({ minutes }) => `${minutes} min. czytania `,
},
footnotes: {
title: "Przypisy",
},
},
pages: {
rss: {

View File

@ -59,6 +59,9 @@ export default {
contentMeta: {
readingTime: ({ minutes }) => `Leitura de ${minutes} min`,
},
footnotes: {
title: "Notas de rodapé",
},
},
pages: {
rss: {

View File

@ -60,6 +60,9 @@ export default {
readingTime: ({ minutes }) =>
minutes == 1 ? `lectură de 1 minut` : `lectură de ${minutes} minute`,
},
footnotes: {
title: "Note de subsol",
},
},
pages: {
rss: {

View File

@ -60,6 +60,9 @@ export default {
contentMeta: {
readingTime: ({ minutes }) => `время чтения ~${minutes} мин.`,
},
footnotes: {
title: "Примечания",
},
},
pages: {
rss: {

View File

@ -59,6 +59,9 @@ export default {
contentMeta: {
readingTime: ({ minutes }) => `อ่านราว ${minutes} นาที`,
},
footnotes: {
title: "เชิงอ้าง",
},
},
pages: {
rss: {

View File

@ -59,6 +59,9 @@ export default {
contentMeta: {
readingTime: ({ minutes }) => `${minutes} dakika okuma süresi`,
},
footnotes: {
title: "Dipnotlar",
},
},
pages: {
rss: {

View File

@ -59,6 +59,9 @@ export default {
contentMeta: {
readingTime: ({ minutes }) => `${minutes} хв читання`,
},
footnotes: {
title: "Примітки",
},
},
pages: {
rss: {

View File

@ -59,6 +59,9 @@ export default {
contentMeta: {
readingTime: ({ minutes }) => `${minutes} phút đọc`,
},
footnotes: {
title: "Chú thích",
},
},
pages: {
rss: {

View File

@ -59,6 +59,9 @@ export default {
contentMeta: {
readingTime: ({ minutes }) => `${minutes}分钟阅读`,
},
footnotes: {
title: "脚注",
},
},
pages: {
rss: {

View File

@ -59,6 +59,9 @@ export default {
contentMeta: {
readingTime: ({ minutes }) => `閱讀時間約 ${minutes} 分鐘`,
},
footnotes: {
title: "腳註",
},
},
pages: {
rss: {

View File

@ -0,0 +1,45 @@
import { QuartzTransformerPlugin } from "../types"
import { Root, Element } from "hast"
import { visit } from "unist-util-visit"
import { i18n } from "../../i18n"
export const LocalizedFootnotes: QuartzTransformerPlugin = () => {
return {
name: "LocalizedFootnotes",
htmlPlugins(ctx) {
return [
() => {
return (tree: Root) => {
const cfg = ctx.cfg.configuration
const locale = i18n(cfg.locale)
visit(tree, "element", (node: Element) => {
// Find footnotes section
if (node.tagName === "section" && node.properties?.["dataFootnotes"] !== undefined) {
// Find the h2 heading inside
const heading = node.children.find(
(child) => child.type === "element" && child.tagName === "h2",
) as Element
if (heading) {
// Remove sr-only class if present
if (Array.isArray(heading.properties?.className)) {
heading.properties.className = heading.properties.className.filter(
(cls) => cls !== "sr-only",
)
}
// Replace the first text node with localized text
const textNode = heading.children.find((child) => child.type === "text")
if (textNode) {
textNode.value = locale.components.footnotes.title
}
}
}
})
}
},
]
},
}
}

View File

@ -11,3 +11,4 @@ export { SyntaxHighlighting } from "./syntax"
export { TableOfContents } from "./toc"
export { HardLineBreaks } from "./linebreaks"
export { RoamFlavoredMarkdown } from "./roam"
export { LocalizedFootnotes } from "./footnotes"