mirror of
https://github.com/jackyzha0/quartz
synced 2026-11-30 22:44:41 +01:00
Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f520811260 | ||
|
|
7e45c5489e | ||
|
|
922bb80cb6 | ||
|
|
7236249485 |
No files matched your search
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@jackyzha0/quartz": patch
|
||||
---
|
||||
|
||||
Sites created with `npx quartz create` from a template (default, blog, docs, obsidian, ttrpg) run GitHubFlavoredMarkdown before ObsidianFlavoredMarkdown (orders 30 and 40), as the default config does and 5.1 requires. The templates still had the old orders (40 and 30). The obsidian and ttrpg templates no longer set `parseArrows`, which ObsidianFlavoredMarkdown doesn't have.
|
||||
@@ -0,0 +1,54 @@
|
||||
import test, { describe } from "node:test"
|
||||
import assert from "node:assert"
|
||||
import fs from "node:fs"
|
||||
import path from "node:path"
|
||||
import { createRequire } from "node:module"
|
||||
import YAML from "yaml"
|
||||
import { validatePluginOptions } from "./plugin-validation.js"
|
||||
|
||||
const root = path.resolve(import.meta.dirname, "..", "..")
|
||||
const templatesDir = path.join(import.meta.dirname, "templates")
|
||||
const configs = [
|
||||
path.join(root, "quartz.config.default.yaml"),
|
||||
...fs
|
||||
.readdirSync(templatesDir)
|
||||
.filter((f) => f.endsWith(".yaml"))
|
||||
.map((f) => path.join(templatesDir, f)),
|
||||
]
|
||||
const require = createRequire(path.join(root, "package.json"))
|
||||
|
||||
function manifestOf(source) {
|
||||
try {
|
||||
return JSON.parse(fs.readFileSync(require.resolve(`${source}/package.json`), "utf8")).quartz
|
||||
} catch {
|
||||
return undefined
|
||||
}
|
||||
}
|
||||
|
||||
for (const file of configs) {
|
||||
const name = path.relative(root, file)
|
||||
const plugins = YAML.parse(fs.readFileSync(file, "utf8")).plugins ?? []
|
||||
const bySource = new Map(plugins.map((entry) => [entry.source, entry]))
|
||||
|
||||
describe(name, () => {
|
||||
test("runs GitHubFlavoredMarkdown before ObsidianFlavoredMarkdown", () => {
|
||||
const gfm = bySource.get("@quartz-community/github-flavored-markdown")
|
||||
const ofm = bySource.get("@quartz-community/obsidian-flavored-markdown")
|
||||
if (!gfm || !ofm) return
|
||||
assert.ok(gfm.order < ofm.order, `GFM order ${gfm.order} must be below OFM ${ofm.order}`)
|
||||
})
|
||||
|
||||
test("sets only options the plugins have", () => {
|
||||
const problems = []
|
||||
for (const entry of plugins) {
|
||||
if (typeof entry.source !== "string" || !entry.options) continue
|
||||
const manifest = manifestOf(entry.source)
|
||||
if (!manifest) continue
|
||||
for (const issue of validatePluginOptions(entry.options, manifest)) {
|
||||
problems.push(`${entry.source}: ${issue.message}`)
|
||||
}
|
||||
}
|
||||
assert.deepStrictEqual(problems, [])
|
||||
})
|
||||
})
|
||||
}
|
||||
@@ -70,10 +70,10 @@ plugins:
|
||||
options:
|
||||
enableInHtmlEmbed: false
|
||||
enableCheckbox: true
|
||||
order: 30
|
||||
order: 40
|
||||
- source: "@quartz-community/github-flavored-markdown"
|
||||
enabled: true
|
||||
order: 40
|
||||
order: 30
|
||||
- source: "@quartz-community/table-of-contents"
|
||||
enabled: true
|
||||
order: 50
|
||||
|
||||
@@ -70,10 +70,10 @@ plugins:
|
||||
options:
|
||||
enableInHtmlEmbed: false
|
||||
enableCheckbox: true
|
||||
order: 30
|
||||
order: 40
|
||||
- source: "@quartz-community/github-flavored-markdown"
|
||||
enabled: true
|
||||
order: 40
|
||||
order: 30
|
||||
- source: "@quartz-community/table-of-contents"
|
||||
enabled: true
|
||||
order: 50
|
||||
|
||||
@@ -71,10 +71,10 @@ plugins:
|
||||
options:
|
||||
enableInHtmlEmbed: false
|
||||
enableCheckbox: true
|
||||
order: 30
|
||||
order: 40
|
||||
- source: "@quartz-community/github-flavored-markdown"
|
||||
enabled: true
|
||||
order: 40
|
||||
order: 30
|
||||
- source: "@quartz-community/table-of-contents"
|
||||
enabled: true
|
||||
order: 50
|
||||
|
||||
@@ -75,16 +75,15 @@ plugins:
|
||||
callouts: true
|
||||
mermaid: true
|
||||
parseTags: true
|
||||
parseArrows: true
|
||||
parseBlockReferences: true
|
||||
enableInHtmlEmbed: false
|
||||
enableYouTubeEmbed: true
|
||||
enableVideoEmbed: true
|
||||
enableCheckbox: true
|
||||
order: 30
|
||||
order: 40
|
||||
- source: "@quartz-community/github-flavored-markdown"
|
||||
enabled: true
|
||||
order: 40
|
||||
order: 30
|
||||
- source: "@quartz-community/table-of-contents"
|
||||
enabled: true
|
||||
order: 50
|
||||
|
||||
@@ -75,16 +75,15 @@ plugins:
|
||||
callouts: true
|
||||
mermaid: true
|
||||
parseTags: true
|
||||
parseArrows: true
|
||||
parseBlockReferences: true
|
||||
enableInHtmlEmbed: false
|
||||
enableYouTubeEmbed: true
|
||||
enableVideoEmbed: true
|
||||
enableCheckbox: true
|
||||
order: 30
|
||||
order: 40
|
||||
- source: "@quartz-community/github-flavored-markdown"
|
||||
enabled: true
|
||||
order: 40
|
||||
order: 30
|
||||
- source: "@quartz-community/table-of-contents"
|
||||
enabled: true
|
||||
order: 50
|
||||
|
||||
Reference in new issue
Block a user