Compare commits

..
Author SHA1 Message Date
saberzero1 4ed26b3943 chore: changeset for quartz build --config (#2646) 2026-11-22 00:44:19 +01:00
Emile Bangma 8f469ed237 Merge pull request #2646 from mabramo/feat/config-flag
feat: Add --config flag to override config file path
2026-11-22 00:43:20 +01:00
Emile Bangma 1dfe7fcdb0 Merge pull request #2656 from jackyzha0/dev-mode/callout-title-inner
fix(styles): style callout titles on .callout-title-inner
2026-11-21 21:44:23 +01:00
saberzero1 7453f7f0d0 chore: lockfile for obsidian-flavored-markdown 2.3.1 (callout titles without a <p>) 2026-11-21 21:42:15 +01:00
saberzero1 9c46b01c57 fix(styles): style callout titles on .callout-title-inner (obsidian-flavored-markdown renders no <p> there, as in Obsidian) 2026-11-21 19:08:56 +01:00
Emile Bangma 842a293ab1 Merge pull request #2653 from jackyzha0/dev-mode/permalink-fixes
fix: permalinks on large sites, permalinks with .. segments, pretty links; alias-redirects 1.0.4, note-properties 1.1.5
2026-11-21 17:07:26 +01:00
Michael Abramo 64dde0cb9c Add -C shorthand for --config and document the build flag 2026-11-20 11:49:54 -05:00
Michael Abramo 46312a6197 Add --config flag to override config file path
Content is relocatable with -d and output with -o, but the config path is
hardcoded to process.cwd()/quartz.config.yaml. This adds --config so the
config can live outside the Quartz checkout, letting one install build
multiple content repos that each carry their own config.

The flag is resolved to an absolute path and passed down via QUARTZ_CONFIG_PATH
so it reaches the esbuild-bundled build code and worker threads. The three
resolveConfigPath() helpers honor it when set, otherwise fall back to the
existing cwd lookup. --watch/--serve also watches the external config.
Includes a unit test for the override.
2026-11-20 00:17:06 -05:00
11 changed files with 72 additions and 5 deletions

No files matched your search

+5
View File
@@ -0,0 +1,5 @@
---
"@jackyzha0/quartz": minor
---
`quartz build --config <path>` (or `-C`) reads the site configuration from another file than `./quartz.config.yaml`, so the config can live with the content outside the Quartz folder, and one Quartz install can build several content repositories (#2646). With `--watch`/`--serve`, changes to that file trigger a rebuild.
+5
View File
@@ -0,0 +1,5 @@
---
"@jackyzha0/quartz": patch
---
Updates `@quartz-community/obsidian-flavored-markdown` to 2.3.1, which renders callout titles in `.callout-title-inner` without a `<p>`, as in Obsidian (themes put the title below its icon otherwise). Callout titles are styled on `.callout-title-inner` itself (colour, margin, line height); the `> p` rule stays for sites on an older obsidian-flavored-markdown.
+12
View File
@@ -11,6 +11,7 @@ The `build` command transforms your Markdown content into a static HTML website.
| Flag | Shorthand | Description | Default |
| ----------------- | --------- | ---------------------------------------------------------------------------------- | ------------------ |
| `--directory` | `-d` | The content folder | `content` |
| `--config` | `-C` | Path to the config file to load (see [[#Custom config file]]) | quartz.config.yaml |
| `--verbose` | `-v` | Print detailed build information (see [[#Verbose output]]) | `false` |
| `--output` | `-o` | The directory where the built site will be saved | `public` |
| `--serve` | | Start a local development server | `false` |
@@ -56,6 +57,17 @@ If you have a very large vault, you can limit the number of concurrent workers t
npx quartz build --concurrency 2
```
### Custom config file
By default Quartz loads `quartz.config.yaml` from the current working directory. Use `--config` (or `-C`) to point at a config file elsewhere — for example when the config lives alongside your content rather than inside the Quartz install.
```shell
npx quartz build --config ../my-vault/quartz.config.yaml
```
> [!note]
> The shorthand for `--config` is an uppercase `-C`. A lowercase `-c` is the shorthand for `--concurrency`, so the two are distinct.
### Verbose output
`npx quartz build --verbose` also prints:
+3 -3
View File
@@ -2923,9 +2923,9 @@
}
},
"node_modules/@quartz-community/obsidian-flavored-markdown": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/@quartz-community/obsidian-flavored-markdown/-/obsidian-flavored-markdown-2.3.0.tgz",
"integrity": "sha512-R4QAnmir6wZO6M8608xAE7Z+O9c8uExhSGXPY0a3W71KnmBzOblU4kzsXjU4T3KaifBAyeYjHAVC39qjBcP6iw==",
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/@quartz-community/obsidian-flavored-markdown/-/obsidian-flavored-markdown-2.3.1.tgz",
"integrity": "sha512-lQucQG1Cm0KrjRQJfaSf0Ud5ugpnLC8ZG5e5cTFrysu2DVkLeS6ks0c0gXXtc6iK1OyZ49Bzug4HkNKZb6AwHQ==",
"license": "MIT",
"dependencies": {
"@quartz-community/rehype-obsidian": "^1.4.0",
+5
View File
@@ -76,6 +76,11 @@ export const SyncArgv = {
export const BuildArgv = {
...CommonArgv,
config: {
string: true,
alias: ["C"],
describe: "path to the config file (default: ./quartz.config.yaml)",
},
output: {
string: true,
alias: ["o"],
+13 -1
View File
@@ -334,6 +334,17 @@ export async function handleBuild(argv) {
argv.watch = true
}
// Let `--config <path>` override the default ./quartz.config.yaml. Passed down
// via env so it reaches the esbuild-bundled build code and worker threads.
if (argv.config) {
const resolved = path.resolve(argv.config)
if (!fs.existsSync(resolved)) {
console.error(`Config file not found: ${resolved}`)
process.exit(1)
}
process.env.QUARTZ_CONFIG_PATH = resolved
}
// " Quartz v5.1.0 " for a release checkout, plus `git describe` (e.g. v5.1.0-3-g1a2b3c4-dirty) otherwise
const checkout = describeQuartzCheckout()
const describe = checkout.describe && checkout.describe !== `v${version}` ? checkout.describe : ""
@@ -607,8 +618,9 @@ export async function handleBuild(argv) {
"quartz.config.yaml",
"quartz.config.default.yaml",
])
const extraWatch = process.env.QUARTZ_CONFIG_PATH ? [process.env.QUARTZ_CONFIG_PATH] : []
chokidar
.watch(paths, { ignoreInitial: true })
.watch([...paths, ...extraWatch], { ignoreInitial: true })
.on("add", () => build(clientRefresh))
.on("change", () => build(clientRefresh))
.on("unlink", () => build(clientRefresh))
+1
View File
@@ -13,6 +13,7 @@ const LEGACY_PLUGINS_JSON_PATH = path.join(process.cwd(), "quartz.plugins.json")
const LEGACY_DEFAULT_PLUGINS_JSON_PATH = path.join(process.cwd(), "quartz.plugins.default.json")
function resolveConfigPath() {
if (process.env.QUARTZ_CONFIG_PATH) return path.resolve(process.env.QUARTZ_CONFIG_PATH)
if (fs.existsSync(CONFIG_YAML_PATH)) return CONFIG_YAML_PATH
if (fs.existsSync(LEGACY_PLUGINS_JSON_PATH)) return LEGACY_PLUGINS_JSON_PATH
if (fs.existsSync(DEFAULT_CONFIG_YAML_PATH)) return DEFAULT_CONFIG_YAML_PATH
@@ -1,8 +1,10 @@
import test, { describe, afterEach } from "node:test"
import assert from "node:assert"
import path from "path"
import {
buildLayoutForEntries,
isExcluded,
resolveConfigPath,
resolveGroups,
validateDependencies,
detectCategoryFromModule,
@@ -13,6 +15,23 @@ import { componentRegistry } from "../../components/registry"
import type { QuartzComponent, QuartzComponentConstructor } from "../../components/types"
import { PluginJsonEntry, LayoutPosition } from "./types"
describe("resolveConfigPath", () => {
afterEach(() => {
delete process.env.QUARTZ_CONFIG_PATH
})
test("QUARTZ_CONFIG_PATH overrides the default lookup", () => {
const custom = path.join("some", "dir", "quartz.config.yaml")
process.env.QUARTZ_CONFIG_PATH = custom
assert.strictEqual(resolveConfigPath(), path.resolve(custom))
})
test("falls back to the cwd default when QUARTZ_CONFIG_PATH is unset", () => {
delete process.env.QUARTZ_CONFIG_PATH
assert.notStrictEqual(resolveConfigPath(), path.resolve("some", "dir", "quartz.config.yaml"))
})
})
const makeComponent = (name: string): QuartzComponent => {
const c = (() => null) as unknown as QuartzComponent
c.displayName = name
+3 -1
View File
@@ -83,7 +83,9 @@ const DEFAULT_CONFIG_YAML_PATH = path.join(process.cwd(), "quartz.config.default
const LEGACY_PLUGINS_JSON_PATH = path.join(process.cwd(), "quartz.plugins.json")
const LEGACY_DEFAULT_PLUGINS_JSON_PATH = path.join(process.cwd(), "quartz.plugins.default.json")
function resolveConfigPath(): string {
/** @internal Exported for testing only. Honors QUARTZ_CONFIG_PATH, else falls back to cwd. */
export function resolveConfigPath(): string {
if (process.env.QUARTZ_CONFIG_PATH) return path.resolve(process.env.QUARTZ_CONFIG_PATH)
if (fs.existsSync(CONFIG_YAML_PATH)) return CONFIG_YAML_PATH
if (fs.existsSync(LEGACY_PLUGINS_JSON_PATH)) return LEGACY_PLUGINS_JSON_PATH
if (fs.existsSync(DEFAULT_CONFIG_YAML_PATH)) return DEFAULT_CONFIG_YAML_PATH
+1
View File
@@ -7,6 +7,7 @@ import type { PluginSource, QuartzPluginsJson } from "./types.js"
import { absorbingBuiltin } from "../builtins/index.js"
function resolveConfigPath(): string {
if (process.env.QUARTZ_CONFIG_PATH) return path.resolve(process.env.QUARTZ_CONFIG_PATH)
const configYamlPath = path.join(process.cwd(), "quartz.config.yaml")
const defaultConfigYamlPath = path.join(process.cwd(), "quartz.config.default.yaml")
const legacyPluginsJsonPath = path.join(process.cwd(), "quartz.plugins.json")
+5
View File
@@ -161,6 +161,9 @@
--callout-icon: var(--callout-icon-fold);
}
// The title's text sits in .callout-title-inner, as in Obsidian; obsidian-flavored-markdown
// before 2.3.1 wrapped it in a <p>
& > .callout-title-inner,
& > .callout-title-inner > p {
color: var(--color);
margin: 0;
@@ -185,5 +188,7 @@
.callout-title-inner {
font-weight: $semiBoldWeight;
// the line height the title had as a <p>
line-height: 1.6rem;
}
}