mirror of
https://github.com/jackyzha0/quartz.git
synced 2026-03-24 15:05:42 -05:00
lint: format
This commit is contained in:
parent
4297be0fcb
commit
431539a363
@ -13,6 +13,7 @@ const config: QuartzConfig = {
|
|||||||
enableSPA: true,
|
enableSPA: true,
|
||||||
enablePopovers: false, // https://github.com/jackyzha0/quartz/issues/890
|
enablePopovers: false, // https://github.com/jackyzha0/quartz/issues/890
|
||||||
analytics: null,
|
analytics: null,
|
||||||
|
locale: "en-US",
|
||||||
baseUrl: "be-far.com",
|
baseUrl: "be-far.com",
|
||||||
ignorePatterns: ["private", "**/templates"],
|
ignorePatterns: ["private", "**/templates"],
|
||||||
theme: {
|
theme: {
|
||||||
@ -36,7 +37,7 @@ const config: QuartzConfig = {
|
|||||||
textHighlight: "#fff23688",
|
textHighlight: "#fff23688",
|
||||||
},
|
},
|
||||||
darkMode: {
|
darkMode: {
|
||||||
light: "#131829",// Backg
|
light: "#131829", // Backg
|
||||||
lightgray: "#70778F", // Code Backg
|
lightgray: "#70778F", // Code Backg
|
||||||
gray: "#686D82", // Unread nodes and subtitles
|
gray: "#686D82", // Unread nodes and subtitles
|
||||||
darkgray: "#cdd6f4", // Text
|
darkgray: "#cdd6f4", // Text
|
||||||
@ -67,8 +68,13 @@ const config: QuartzConfig = {
|
|||||||
Plugin.TableOfContents(),
|
Plugin.TableOfContents(),
|
||||||
Plugin.CrawlLinks({ markdownLinkResolution: "shortest" }),
|
Plugin.CrawlLinks({ markdownLinkResolution: "shortest" }),
|
||||||
Plugin.Description(),
|
Plugin.Description(),
|
||||||
Plugin.Remark42({ host: "https://be-far.com/comments", site_id: "remark", theme: "dark", no_footer: true }),
|
Plugin.Remark42({
|
||||||
Plugin.Latex({renderEngine: "katex"})
|
host: "https://be-far.com/comments",
|
||||||
|
site_id: "remark",
|
||||||
|
theme: "dark",
|
||||||
|
no_footer: true,
|
||||||
|
}),
|
||||||
|
Plugin.Latex({ renderEngine: "katex" }),
|
||||||
],
|
],
|
||||||
filters: [Plugin.RemoveDrafts()],
|
filters: [Plugin.RemoveDrafts()],
|
||||||
emitters: [
|
emitters: [
|
||||||
|
|||||||
@ -28,16 +28,22 @@ export const defaultContentPageLayout: PageLayout = {
|
|||||||
Component.MobileOnly(Component.Spacer()),
|
Component.MobileOnly(Component.Spacer()),
|
||||||
Component.Search(),
|
Component.Search(),
|
||||||
Component.Darkmode(),
|
Component.Darkmode(),
|
||||||
Component.DesktopOnly(Component.Explorer({
|
Component.DesktopOnly(
|
||||||
|
Component.Explorer({
|
||||||
sortFn: (a, b) => {
|
sortFn: (a, b) => {
|
||||||
const emojis = /([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g
|
const emojis =
|
||||||
const a_name = a.name.replace(emojis, '').trim()
|
/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g
|
||||||
const a_dname = a.displayName.replace(emojis, '').trim()
|
const a_name = a.name.replace(emojis, "").trim()
|
||||||
const b_name = b.name.replace(emojis, '').trim()
|
const a_dname = a.displayName.replace(emojis, "").trim()
|
||||||
const b_dname = b.displayName.replace(emojis, '').trim()
|
const b_name = b.name.replace(emojis, "").trim()
|
||||||
|
const b_dname = b.displayName.replace(emojis, "").trim()
|
||||||
// Sort order: folders first, then files. Sort folders and files alphabetically
|
// Sort order: folders first, then files. Sort folders and files alphabetically
|
||||||
if (/^.*Home$/.test(a_dname)) { return -1 }
|
if (/^.*Home$/.test(a_dname)) {
|
||||||
if (/^.*Home$/.test(b_dname)) { return 1 }
|
return -1
|
||||||
|
}
|
||||||
|
if (/^.*Home$/.test(b_dname)) {
|
||||||
|
return 1
|
||||||
|
}
|
||||||
if ((!a.file && !b.file) || (a.file && b.file)) {
|
if ((!a.file && !b.file) || (a.file && b.file)) {
|
||||||
// numeric: true: Whether numeric collation should be used, such that "1" < "2" < "10"
|
// numeric: true: Whether numeric collation should be used, such that "1" < "2" < "10"
|
||||||
// sensitivity: "base": Only strings that differ in base letters compare as unequal. Examples: a ≠ b, a = á, a = A
|
// sensitivity: "base": Only strings that differ in base letters compare as unequal. Examples: a ≠ b, a = á, a = A
|
||||||
@ -51,8 +57,9 @@ export const defaultContentPageLayout: PageLayout = {
|
|||||||
} else {
|
} else {
|
||||||
return -1
|
return -1
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
})),
|
}),
|
||||||
|
),
|
||||||
//Component.TableOfContents(),
|
//Component.TableOfContents(),
|
||||||
],
|
],
|
||||||
right: [
|
right: [
|
||||||
|
|||||||
@ -16,16 +16,17 @@ export default ((opts?: Optionss) => {
|
|||||||
<footer class={`${displayClass ?? ""}`}>
|
<footer class={`${displayClass ?? ""}`}>
|
||||||
<hr />
|
<hr />
|
||||||
<p style="margin-bottom:4px;font-weight:bold;font-size:2em;">
|
<p style="margin-bottom:4px;font-weight:bold;font-size:2em;">
|
||||||
Share your thoughts with <a class="internal" href="/Projects/Obsidian/quartz-comments">Remark42</a>
|
Share your thoughts with{" "}
|
||||||
|
<a class="internal" href="/Projects/Obsidian/quartz-comments">
|
||||||
|
Remark42
|
||||||
|
</a>
|
||||||
</p>
|
</p>
|
||||||
<div id="remark42"></div>
|
<div id="remark42"></div>
|
||||||
<hr />
|
<hr />
|
||||||
<p>
|
<p>
|
||||||
© be-far {year}. Powered by <a href="https://quartz.jzhao.xyz/">Quartz</a>.
|
© be-far {year}. Powered by <a href="https://quartz.jzhao.xyz/">Quartz</a>.
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>not legal advice 🤟</p>
|
||||||
not legal advice 🤟
|
|
||||||
</p>
|
|
||||||
<ul>
|
<ul>
|
||||||
{Object.entries(links).map(([text, link]) => (
|
{Object.entries(links).map(([text, link]) => (
|
||||||
<li>
|
<li>
|
||||||
|
|||||||
@ -115,7 +115,7 @@ export default ((opts?: Partial<TagContentOptions>) => {
|
|||||||
{pages.length != 0 && (
|
{pages.length != 0 && (
|
||||||
<p>
|
<p>
|
||||||
{i18n(cfg.locale).pages.tagContent.itemsUnderTag({
|
{i18n(cfg.locale).pages.tagContent.itemsUnderTag({
|
||||||
count: pages.length
|
count: pages.length,
|
||||||
})}
|
})}
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@ -215,12 +215,28 @@ export function renderPage(
|
|||||||
const lang = componentData.fileData.frontmatter?.lang ?? cfg.locale?.split("-")[0] ?? "en"
|
const lang = componentData.fileData.frontmatter?.lang ?? cfg.locale?.split("-")[0] ?? "en"
|
||||||
const doc = (
|
const doc = (
|
||||||
<html lang={lang}>
|
<html lang={lang}>
|
||||||
<Head {...componentData}/>
|
<Head {...componentData} />
|
||||||
<head>
|
<head>
|
||||||
{ slug === "index" ?
|
{slug === "index" ? (
|
||||||
<link rel="alternate" type="application/rss+xml" href="/index.xml" title="Newest in Projects & Privacy"/>: <></>}
|
<link
|
||||||
{ slug === "index" ?
|
rel="alternate"
|
||||||
<link rel="alternate" type="application/rss+xml" href="/Updates.xml" title="Projects & Privacy Monthly"/>: <></>}
|
type="application/rss+xml"
|
||||||
|
href="/index.xml"
|
||||||
|
title="Newest in Projects & Privacy"
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<></>
|
||||||
|
)}
|
||||||
|
{slug === "index" ? (
|
||||||
|
<link
|
||||||
|
rel="alternate"
|
||||||
|
type="application/rss+xml"
|
||||||
|
href="/Updates.xml"
|
||||||
|
title="Projects & Privacy Monthly"
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<></>
|
||||||
|
)}
|
||||||
</head>
|
</head>
|
||||||
<body data-slug={slug}>
|
<body data-slug={slug}>
|
||||||
<div id="quartz-root" class="page">
|
<div id="quartz-root" class="page">
|
||||||
@ -234,11 +250,8 @@ export function renderPage(
|
|||||||
))}
|
))}
|
||||||
</Header>
|
</Header>
|
||||||
<div class="popover-hint">
|
<div class="popover-hint">
|
||||||
{ slug !== "index" &&
|
{slug !== "index" &&
|
||||||
beforeBody.map((BodyComponent) =>
|
beforeBody.map((BodyComponent) => <BodyComponent {...componentData} />)}
|
||||||
(<BodyComponent {...componentData} />)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<Content {...componentData} />
|
<Content {...componentData} />
|
||||||
|
|||||||
@ -85,9 +85,9 @@ function generateRSSFeed(cfg: GlobalConfiguration, idx: ContentIndex, limit?: nu
|
|||||||
<channel>
|
<channel>
|
||||||
<title>${escapeHTML(cfg.pageTitle)}</title>
|
<title>${escapeHTML(cfg.pageTitle)}</title>
|
||||||
<link>${base}</link>
|
<link>${base}</link>
|
||||||
<description>${!!limit ? `Last ${limit} notes` : "Recent notes"} on ${
|
<description>${!!limit ? `Last ${limit} notes` : "Recent notes"} on ${escapeHTML(
|
||||||
escapeHTML(cfg.pageTitle)
|
cfg.pageTitle,
|
||||||
}</description>
|
)}</description>
|
||||||
<generator>Quartz -- quartz.jzhao.xyz</generator>
|
<generator>Quartz -- quartz.jzhao.xyz</generator>
|
||||||
${items}
|
${items}
|
||||||
</channel>
|
</channel>
|
||||||
@ -120,7 +120,12 @@ export const ContentIndex: QuartzEmitterPlugin<Partial<Options>> = (opts) => {
|
|||||||
},
|
},
|
||||||
async emit(ctx, content, _resources) {
|
async emit(ctx, content, _resources) {
|
||||||
// If we're missing an index file, don't bother with sitemap/RSS gen
|
// If we're missing an index file, don't bother with sitemap/RSS gen
|
||||||
if (!(opts?.bypassIndexCheck || content.map((c) => c[1].data.slug!).includes("index" as FullSlug))) {
|
if (
|
||||||
|
!(
|
||||||
|
opts?.bypassIndexCheck ||
|
||||||
|
content.map((c) => c[1].data.slug!).includes("index" as FullSlug)
|
||||||
|
)
|
||||||
|
) {
|
||||||
console.warn(
|
console.warn(
|
||||||
chalk.yellow(`Warning: contentIndex:
|
chalk.yellow(`Warning: contentIndex:
|
||||||
content/ folder is missing an index.md. RSS feeds and sitemap will not be generated.
|
content/ folder is missing an index.md. RSS feeds and sitemap will not be generated.
|
||||||
|
|||||||
@ -10,7 +10,7 @@ interface Options {
|
|||||||
components?: Array<String>
|
components?: Array<String>
|
||||||
max_shown_comments?: number
|
max_shown_comments?: number
|
||||||
max_last_comments?: number
|
max_last_comments?: number
|
||||||
theme?: 'light' | 'dark'
|
theme?: "light" | "dark"
|
||||||
page_title?: string // Don't use this, it'll break your comment database. It's included for the sake of completeness.
|
page_title?: string // Don't use this, it'll break your comment database. It's included for the sake of completeness.
|
||||||
locale?: string // Technically an enum, full list at https://remark42.com/docs/configuration/frontend/#locales
|
locale?: string // Technically an enum, full list at https://remark42.com/docs/configuration/frontend/#locales
|
||||||
show_email_subscription?: boolean
|
show_email_subscription?: boolean
|
||||||
@ -38,8 +38,8 @@ export const Remark42: QuartzTransformerPlugin<Options> = (opts?: Options) => {
|
|||||||
// Put the embeddable components into window scope
|
// Put the embeddable components into window scope
|
||||||
function getComment(e: Array<String>) {
|
function getComment(e: Array<String>) {
|
||||||
for (var o = 0; o < e.length; o++) {
|
for (var o = 0; o < e.length; o++) {
|
||||||
var src = opts?.host + '/web/' + e[o] + '.js'
|
var src = opts?.host + "/web/" + e[o] + ".js"
|
||||||
scripts.push({ src: src, loadTime: "afterDOMReady", contentType: "external", })
|
scripts.push({ src: src, loadTime: "afterDOMReady", contentType: "external" })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
getComment(opts?.components || ["embed"])
|
getComment(opts?.components || ["embed"])
|
||||||
@ -62,7 +62,6 @@ export const Remark42: QuartzTransformerPlugin<Options> = (opts?: Options) => {
|
|||||||
`
|
`
|
||||||
scripts.push({ script: spaRouting, loadTime: "afterDOMReady", contentType: "inline" })
|
scripts.push({ script: spaRouting, loadTime: "afterDOMReady", contentType: "inline" })
|
||||||
|
|
||||||
|
|
||||||
// @plodibre: Listen for theme changes and sync r42 if it changes
|
// @plodibre: Listen for theme changes and sync r42 if it changes
|
||||||
const buttonListener: string = `
|
const buttonListener: string = `
|
||||||
document.querySelector('#darkmode-toggle').addEventListener('click', (_e) => {
|
document.querySelector('#darkmode-toggle').addEventListener('click', (_e) => {
|
||||||
@ -82,9 +81,8 @@ export const Remark42: QuartzTransformerPlugin<Options> = (opts?: Options) => {
|
|||||||
css: [
|
css: [
|
||||||
// base css
|
// base css
|
||||||
],
|
],
|
||||||
js: scripts
|
js: scripts,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: "Monaspace Neon";
|
font-family: "Monaspace Neon";
|
||||||
src: url('/static/fonts/heading-font.otf') format('opentype');
|
src: url("/static/fonts/heading-font.otf") format("opentype");
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-display: swap;
|
font-display: swap;
|
||||||
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: "Monaspace Argon";
|
font-family: "Monaspace Argon";
|
||||||
src: url('/static/fonts/main-font.otf') format('opentype');
|
src: url("/static/fonts/main-font.otf") format("opentype");
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-display: swap;
|
font-display: swap;
|
||||||
@ -112,7 +112,6 @@ footer > p {
|
|||||||
margin-right: 8px;
|
margin-right: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ul {
|
ul {
|
||||||
margin-top: 2px;
|
margin-top: 2px;
|
||||||
padding-top: 0px;
|
padding-top: 0px;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user