mirror of
https://github.com/jackyzha0/quartz
synced 2026-11-30 22:44:41 +01:00
Compare commits
25
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7688df602b | ||
|
|
fc865525b7 | ||
|
|
3c7cba46ae | ||
|
|
4683f8b462 | ||
|
|
8be3806431 | ||
|
|
98cfbfabe8 | ||
|
|
6c91c6d621 | ||
|
|
f687f582f6 | ||
|
|
03996bb87a | ||
|
|
f30980744a | ||
|
|
483b7629e5 | ||
|
|
fe6a3ea879 | ||
|
|
df7e0180da | ||
|
|
0787f97149 | ||
|
|
b29db43197 | ||
|
|
214f478389 | ||
|
|
66f2578e42 | ||
|
|
addf542511 | ||
|
|
60c8318b34 | ||
|
|
e3e3d5f398 | ||
|
|
28fcb64720 | ||
|
|
99909ddb22 | ||
|
|
2ef60c6be5 | ||
|
|
f8b563867b | ||
|
|
913f9f06b5 |
No files matched your search
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@jackyzha0/quartz": patch
|
||||
---
|
||||
|
||||
More build errors caused by content are reported as content problems ("fix the file and build again") instead of "This is likely a Quartz bug": frontmatter that holds a single value or a list instead of properties, Markdown files and assets Quartz can't read (permission denied, a directory named like a note). Plugins can do the same by throwing an `Error` with `quartzContent = true` (see "Reporting problems in content" in Making plugins).
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@jackyzha0/quartz": patch
|
||||
---
|
||||
|
||||
When a build stops on an error, Quartz stops esbuild before exiting. esbuild runs as a child process that writes to the same terminal; left running, it could print "fatal error: all goroutines are asleep - deadlock!" and a long goroutine dump after Quartz's error message.
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@jackyzha0/quartz": patch
|
||||
---
|
||||
|
||||
The folder hierarchy used by folder pages and breadcrumbs now includes the pages of page types that render files (`.base`, `.canvas`, …): folder pages list them, and a folder that holds only such pages has its own node (#2576). Documented that while a page type's `generate` runs, `ctx.virtualPages` holds the virtual pages of the page types before it.
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@jackyzha0/quartz": patch
|
||||
---
|
||||
|
||||
Embedding a section by the anchor Obsidian writes for its heading works when that anchor differs from the heading's id: `![[note#Colon unspaced]]` now embeds `## Colon:unspaced`. It needs GitHubFlavoredMarkdown 2.1.0 or later, which marks those anchors on the heading.
|
||||
@@ -0,0 +1,10 @@
|
||||
---
|
||||
"@jackyzha0/quartz": patch
|
||||
---
|
||||
|
||||
Links as in Obsidian 1.15.0:
|
||||
|
||||
- A Markdown link whose path is not valid percent-encoding (`[x](%zz)`, `[x](a%E2.md)`) is an external link. Before, it failed the whole build with `URI malformed`.
|
||||
- Link paths are NFC-normalized, so a link spelled with a decomposed `é` reaches `café.md`.
|
||||
- An image of a file the site doesn't have, with no alt text, gets its percent-decoded path as alt (`` → “missing pic.png”), as Obsidian names a missing embed.
|
||||
- A wikilink's `^id` no longer names its paragraph (Obsidian Flavored Markdown).
|
||||
@@ -5,7 +5,7 @@
|
||||
Updated default plugins (see each plugin's changelog for details):
|
||||
|
||||
- **Changed heading ids:** with SmartyPants on (the default), a heading containing `--` now gets the same id as on GitHub: `## Range 1--2` → `range-1--2` (was `range-12`). Links that hard-code the old id need updating; `[[page#Range 1--2]]` keeps working. Links Obsidian writes to headings containing `:`, `|`, `^`, `#` or `\` now reach them, and heading ids, links and table-of-contents entries share one slug function (GitHubFlavoredMarkdown 2.1.0, TableOfContents, CrawlLinks, utils 1.1).
|
||||
- **Changed in Bases:** `file.name` includes the file's extension, as in Obsidian (`Note.md`, `Plan.canvas`); use `file.basename` for the name without it. Base views also list canvas and Excalidraw files with their real paths, `this` in a base embedded in a note is that note, `file.inFolder("")` matches the content root, and Quartz's generated pages (404, tags, folder listings) no longer appear as notes (BasesPage 1.1.0, CanvasPage, Excalidraw).
|
||||
- **Bases now behave as in Obsidian 1.15** (BasesPage 1.2.0, checked against real Obsidian): subtracting dates gives a duration (`(due - today()).days`); nested tags match (`file.tags.contains("#project")` finds `#project/x`); dates display in the site's locale, and `date()` reads only ISO-style dates; cards use Obsidian's aspect ratio and layout; `link()` with any URL is an external link; a base opens on its first view; tags link to their tag pages; `this.<property>` in an embedded base reads the embedding note. Base views also list canvas and Excalidraw files with their real paths, `this` in an embedded base is that note, and Quartz's generated pages (404, tags, folder listings) no longer appear as notes. **Changed:** `file.tags` keeps `#` and the original case, the `tags` property no longer includes inline tags, `hasTag(a, b)` matches any of its tags, the root folder is `/`, text `contains` ignores case, and the cards' `imageAspectRatio` is height/width (it was inverted). `file.name` is as in Obsidian: a Markdown note's name has no extension (`Note`), other files keep theirs (`Plan.canvas`); `file.fullname` has the extension for every file.
|
||||
- Folder pages list folders that hold only canvas, base or other generated pages (FolderPage).
|
||||
- A footnote referenced only from a table cell past the table's columns is rendered, as in Obsidian (ObsidianFlavoredMarkdown 2.1.1, with remark-obsidian 2.2.0: faster parsing and fixes for deeply nested notes and `\r\n` line endings).
|
||||
- A short wikilink to an Obsidian folder note (`[[Topic]]` for `Topic/Topic.md`) reaches the folder page (utils 1.1).
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@jackyzha0/quartz": patch
|
||||
---
|
||||
|
||||
Plugins use Quartz's own Preact instead of each bundling a copy, so components can use hooks and context across plugins (a component using `preact/hooks` with another plugin's components crashed), and plugin bundles are smaller. The default plugins and the plugin template are updated; a third-party plugin made from the template before this release still bundles its own copy until it updates its `tsup.config.ts` (see quartz-community/plugin-template).
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@jackyzha0/quartz": minor
|
||||
---
|
||||
|
||||
Pages that page types render from files (`.base`, `.canvas`, Excalidraw drawings) follow the site's publish filters (quartz-community/bases-page#11). The filters see each such page with the frontmatter its page type gives it and `file.data.referencedBy`, the published pages that link to it; a page a filter rejects is not emitted and not listed in the content index, sitemap, RSS, folder pages, explorer or search, and can't be embedded. Before, every such file was published regardless of the filters. New transformer hook `virtualPageHtmlPlugins(ctx, content)`: rehype plugins run on these pages' rendered bodies, which never pass through `htmlPlugins`, so plugins such as encrypted-pages can encrypt them.
|
||||
@@ -96,6 +96,7 @@ export type QuartzTransformerPluginInstance = {
|
||||
textTransform?: (ctx: BuildCtx, src: string) => string
|
||||
markdownPlugins?: (ctx: BuildCtx) => PluggableList
|
||||
htmlPlugins?: (ctx: BuildCtx) => PluggableList
|
||||
virtualPageHtmlPlugins?: (ctx: BuildCtx, content: ProcessedContent[]) => PluggableList
|
||||
externalResources?: (ctx: BuildCtx) => Partial<StaticResources>
|
||||
}
|
||||
```
|
||||
@@ -105,6 +106,7 @@ All transformer plugins must define at least a `name` field to register the plug
|
||||
- `textTransform` performs a text-to-text transformation _before_ a file is parsed into the [Markdown AST](https://github.com/syntax-tree/mdast).
|
||||
- `markdownPlugins` defines a list of [remark plugins](https://github.com/remarkjs/remark/blob/main/doc/plugins.md). `remark` is a tool that transforms Markdown to Markdown in a structured way.
|
||||
- `htmlPlugins` defines a list of [rehype plugins](https://github.com/rehypejs/rehype/blob/main/doc/plugins.md). Similar to how `remark` works, `rehype` is a tool that transforms HTML to HTML in a structured way.
|
||||
- `virtualPageHtmlPlugins` (Quartz 5.1+) defines rehype plugins for the pages that page types render from files (`.base`, `.canvas`, Excalidraw drawings). Those pages are rendered when emitting and never pass through `htmlPlugins`, so a plugin that should also act on them (e.g. encryption) registers its rehype plugin here too. They run on the page's rendered body, with the page's vfile (`file.data.frontmatter`, `file.data.referencedBy`), after the filters published the page; the page then shows the resulting tree. `content` is the published content.
|
||||
- `externalResources` defines any external resources the plugin may need to load on the client-side for it to work properly.
|
||||
|
||||
Normally for both `remark` and `rehype`, you can find existing plugins that you can use. If you'd like to create your own `remark` or `rehype` plugin, checkout the [guide to creating a plugin](https://unifiedjs.com/learn/guide/create-a-plugin/) using `unified` (the underlying AST parser and transformer library).
|
||||
@@ -257,6 +259,8 @@ export type QuartzFilterPluginInstance = {
|
||||
|
||||
A filter plugin must define a `name` field and a `shouldPublish` function that takes in a piece of content that has been processed by all the transformers and returns a `true` or `false` depending on whether it should be passed to the emitter plugins or not.
|
||||
|
||||
Filters also see the pages that page types render from files (Quartz 5.1+; page types that declare `fileExtensions`, e.g. `.base` and `.canvas` pages), with the frontmatter the page type gives them and `file.data.referencedBy`: the published pages that link to them. A page a filter rejects is not emitted, listed or embeddable. Such files may have no frontmatter (`.base`, `.canvas`): [[ExplicitPublish]] publishes them when a published page links to them.
|
||||
|
||||
For example, here is a filter that removes drafts (Quartz has this [[RemoveDrafts|built in]]):
|
||||
|
||||
```ts
|
||||
@@ -389,7 +393,7 @@ export interface QuartzPageTypePluginInstance {
|
||||
|
||||
- `name`: A unique identifier for this page type.
|
||||
- `priority`: Controls matching order when multiple page types could match a slug. Higher priority page types are checked first. Default: `0`.
|
||||
- `fileExtensions`: Array of file extensions this page type handles (e.g. `[".canvas"]`, `[".base"]`). Content files (`.md`) are handled by the default content page type.
|
||||
- `fileExtensions`: Array of file extensions this page type handles (e.g. `[".canvas"]`, `[".base"]`). Content files (`.md`) are handled by the default content page type. The pages of such a page type stand for files: Quartz runs the site's filters on them (Quartz 5.1+), so give each page the file's `filePath` / `relativePath` and, if the file has frontmatter, that frontmatter.
|
||||
- `match`: A function that determines whether a given slug/file should be rendered by this page type.
|
||||
- `generate`: An optional function that produces virtual pages (pages not backed by files on disk, such as folder listings or tag indices). It receives `{ content, cfg, ctx }` and returns the pages, or (Quartz 5.1+) a promise of them, so it can do async work such as running content through the site's transformers or bundling with esbuild. Page types generate one after another, in priority order. A plugin with an async `generate` should declare `"quartzVersion": ">=5.1.0"`, since older versions don't wait for it.
|
||||
- `layout`: The layout configuration key (e.g. `"content"`, `"folder"`, `"tag"`). This determines which `byPageType` entry in `quartz.config.yaml` provides the layout overrides for this page type.
|
||||
@@ -583,6 +587,18 @@ Each view registration includes:
|
||||
|
||||
The `ViewRegistry` is a global singleton (via `Symbol.for`) ensuring all copies of the module share the same registry.
|
||||
|
||||
### Reporting problems in content
|
||||
|
||||
When your plugin fails because of a file's content rather than a bug in your code — a `.canvas` file that isn't valid JSON, a property with a value your plugin can't use, a file it can't read — throw an `Error` with `quartzContent` set to `true` and a message that names the problem:
|
||||
|
||||
```ts
|
||||
const err = new Error(`Invalid canvas: ${parseError.message}`)
|
||||
;(err as Error & { quartzContent?: boolean }).quartzContent = true
|
||||
throw err
|
||||
```
|
||||
|
||||
Quartz then reports it as a problem in the file's content ("fix it and build again") instead of asking the user to report a bug in your plugin, and leaves out the stack trace. Errors from transformers name the file being processed; from an emitter or a page type's `generate`, put the file's path in your message. Quartz checks the property, not the class, so plugins don't need to import anything from Quartz; it also finds the property on an error's `cause`. Only use it when the content is at fault — a wrong guess sends users looking for a problem in their notes that isn't there.
|
||||
|
||||
## Building and Distribution
|
||||
|
||||
Quartz v5 plugins ship pre-built `dist/` in their repositories. When a user installs your plugin, Quartz detects the pre-built output and skips the install/build cycle entirely — making installation near-instant.
|
||||
|
||||
@@ -12,6 +12,8 @@ There may be some notes you want to avoid publishing as a website. Quartz suppor
|
||||
|
||||
If you'd like to only publish a select number of notes, you can instead use [[ExplicitPublish]] which will filter out all notes except for any that have `publish: true` in the frontmatter.
|
||||
|
||||
Bases, canvases and Excalidraw drawings follow the same filters. A drawing stored as Markdown has frontmatter of its own. A `.base` or `.canvas` file has none: with [[ExplicitPublish]] it is published when a published note links to it, and with encrypted pages it is encrypted with the password of the encrypted note that links to it.
|
||||
|
||||
> [!warning]
|
||||
> Regardless of the filter plugin used, **all non-markdown files will be emitted and available publicly in the final build.** This includes files such as images, voice recordings, PDFs, etc.
|
||||
|
||||
|
||||
@@ -16,6 +16,8 @@ This plugin filters content based on an explicit `publish` flag in the frontmatt
|
||||
|
||||
This plugin has no configuration options.
|
||||
|
||||
Files without frontmatter — `.base`, `.canvas` and `.excalidraw` files — can't be marked `publish: true`. They are published when a published page links to them (`[[Board.canvas]]`, or an embed such as `![[Board.canvas]]`), like Obsidian Publish adding the files a published note links to, and not otherwise. A base embedded in a published note renders inside it without a page of its own. A drawing stored as Markdown (`.excalidraw.md`) follows its own `publish:` like a note. (Quartz 5.1+.)
|
||||
|
||||
> [!tip]
|
||||
> Images and other files are copied to your site whether or not a published page uses them. Set `configuration.publishAssets: referenced` to only publish the files that published pages link to or embed.
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ Common issues and solutions when working with Quartz.
|
||||
## Reading build output
|
||||
|
||||
- **Errors from plugins** say which plugin failed (name, version, source), what it was doing ("while transforming the Markdown of `notes/x.md`", "component Backlinks while rendering `features/x`"), any problems Quartz already knew about that plugin, and where to report it. To confirm a plugin is the cause, disable it (`npx quartz plugin disable <name>`) and build again.
|
||||
- **Problems in a file's content** (frontmatter that isn't valid YAML/TOML, a file Quartz can't read) name the file and say "This is a problem in the file's content": fix the file and build again — it's not a bug in Quartz or a plugin.
|
||||
- **Plugins that fail to load** (can't be installed, their code throws on import, no plugin found in the package) are marked `✗` with the file and line where it failed. Locally the build continues without them so you can check the rest of the site; they are listed again at the top of the end-of-build summary. In CI (`CI` set, e.g. GitHub Actions, Netlify, Vercel, Cloudflare Pages) the build fails instead, so a site with a missing feature isn't deployed — set `QUARTZ_ALLOW_BROKEN_PLUGINS=1` to deploy anyway.
|
||||
- **Warnings** printed while loading the config (plugins that need a newer Quartz, plugins missing data they need, layout typos, plugin entries that are now built in) are repeated in a summary at the end of the build.
|
||||
- **Notes** in that summary point out links to pages that are not on your site — including links to [[RemoveDrafts|drafts]], which are the usual cause of "this link 404s". `npx quartz build --verbose` lists every such link, the order plugins run in, the built-ins and the layout of each page type.
|
||||
|
||||
Generated
+134
-135
@@ -14,46 +14,46 @@
|
||||
"@myriaddreamin/rehype-typst": "^0.7.0",
|
||||
"@napi-rs/simple-git": "1.1.0",
|
||||
"@quartz-community/alias-redirects": "^1.0.2",
|
||||
"@quartz-community/article-title": "^1.0.1",
|
||||
"@quartz-community/backlinks": "^1.0.2",
|
||||
"@quartz-community/bases-page": "^1.1.0",
|
||||
"@quartz-community/breadcrumbs": "^1.0.2",
|
||||
"@quartz-community/canvas-page": "^1.0.2",
|
||||
"@quartz-community/article-title": "^1.0.2",
|
||||
"@quartz-community/backlinks": "^1.0.3",
|
||||
"@quartz-community/bases-page": "^1.2.1",
|
||||
"@quartz-community/breadcrumbs": "^1.0.3",
|
||||
"@quartz-community/canvas-page": "^1.0.3",
|
||||
"@quartz-community/citations": "^1.0.1",
|
||||
"@quartz-community/cname": "^1.0.1",
|
||||
"@quartz-community/comments": "^1.0.1",
|
||||
"@quartz-community/content-meta": "^1.0.1",
|
||||
"@quartz-community/content-page": "^1.0.2",
|
||||
"@quartz-community/comments": "^1.0.2",
|
||||
"@quartz-community/content-meta": "^1.0.2",
|
||||
"@quartz-community/content-page": "^1.0.3",
|
||||
"@quartz-community/created-modified-date": "^1.0.2",
|
||||
"@quartz-community/darkmode": "^1.0.1",
|
||||
"@quartz-community/darkmode": "^1.0.2",
|
||||
"@quartz-community/description": "^1.0.2",
|
||||
"@quartz-community/encrypted-pages": "^1.0.1",
|
||||
"@quartz-community/explicit-publish": "^1.0.1",
|
||||
"@quartz-community/explorer": "^1.0.2",
|
||||
"@quartz-community/encrypted-pages": "^1.1.1",
|
||||
"@quartz-community/explicit-publish": "^1.1.0",
|
||||
"@quartz-community/explorer": "^1.0.3",
|
||||
"@quartz-community/favicon": "^1.0.1",
|
||||
"@quartz-community/folder-page": "^1.0.2",
|
||||
"@quartz-community/footer": "^1.1.0",
|
||||
"@quartz-community/github-flavored-markdown": "^2.1.0",
|
||||
"@quartz-community/graph": "^1.0.2",
|
||||
"@quartz-community/folder-page": "^1.0.3",
|
||||
"@quartz-community/footer": "^1.1.1",
|
||||
"@quartz-community/github-flavored-markdown": "^2.1.1",
|
||||
"@quartz-community/graph": "^1.0.3",
|
||||
"@quartz-community/hard-line-breaks": "^1.1.0",
|
||||
"@quartz-community/latex": "^1.0.1",
|
||||
"@quartz-community/note-properties": "^1.1.3",
|
||||
"@quartz-community/obsidian-flavored-markdown": "^2.1.1",
|
||||
"@quartz-community/note-properties": "^1.1.4",
|
||||
"@quartz-community/obsidian-flavored-markdown": "^2.1.3",
|
||||
"@quartz-community/og-image": "^1.1.1",
|
||||
"@quartz-community/ox-hugo": "^1.0.1",
|
||||
"@quartz-community/page-title": "^1.0.1",
|
||||
"@quartz-community/page-title": "^1.0.2",
|
||||
"@quartz-community/quartz-fonts": "^1.0.2",
|
||||
"@quartz-community/reader-mode": "^1.0.1",
|
||||
"@quartz-community/recent-notes": "^1.0.2",
|
||||
"@quartz-community/reader-mode": "^1.0.2",
|
||||
"@quartz-community/recent-notes": "^1.0.3",
|
||||
"@quartz-community/roam": "^1.0.1",
|
||||
"@quartz-community/search": "^1.0.2",
|
||||
"@quartz-community/spacer": "^1.0.1",
|
||||
"@quartz-community/stacked-pages": "^1.0.2",
|
||||
"@quartz-community/syntax-highlighting": "^1.0.2",
|
||||
"@quartz-community/table-of-contents": "^1.0.2",
|
||||
"@quartz-community/tag-list": "^1.0.2",
|
||||
"@quartz-community/tag-page": "^1.0.2",
|
||||
"@quartz-community/unlisted-pages": "^1.0.1",
|
||||
"@quartz-community/search": "^1.0.3",
|
||||
"@quartz-community/spacer": "^1.0.2",
|
||||
"@quartz-community/stacked-pages": "^1.0.3",
|
||||
"@quartz-community/syntax-highlighting": "^1.0.3",
|
||||
"@quartz-community/table-of-contents": "^1.0.3",
|
||||
"@quartz-community/tag-list": "^1.0.3",
|
||||
"@quartz-community/tag-page": "^1.0.3",
|
||||
"@quartz-community/unlisted-pages": "^1.1.0",
|
||||
"@quartz-themes/core": "^2.0.1",
|
||||
"ansi-truncate": "^1.4.0",
|
||||
"async-mutex": "^0.5.0",
|
||||
@@ -97,8 +97,8 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@changesets/cli": "^2.29.2",
|
||||
"@quartz-community/types": "^1.2.0",
|
||||
"@quartz-community/utils": "^1.1.1",
|
||||
"@quartz-community/types": "^1.3.0",
|
||||
"@quartz-community/utils": "^1.2.0",
|
||||
"@types/hast": "^3.0.4",
|
||||
"@types/js-yaml": "^4.0.9",
|
||||
"@types/node": "^26.5.1",
|
||||
@@ -2376,9 +2376,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@quartz-community/article-title": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/article-title/-/article-title-1.0.1.tgz",
|
||||
"integrity": "sha512-i/pDWGHrbkYJ4ZmZTecgUu6SWKoeac/CCSp5/AD1owdSp5AM3OeHJMvy3cgtiVRk80p/QY27C60RyVKj1NT5Dg==",
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/article-title/-/article-title-1.0.2.tgz",
|
||||
"integrity": "sha512-WQISg0GyglaRx4HsfUu43ny7PVe1lGk0fVohVOQu46JWKAk+UJCqP09BigRwzRJuqcUOzawjxueire1agfUwVA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@quartz-community/types": "^1.0.0",
|
||||
@@ -2398,9 +2398,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@quartz-community/backlinks": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/backlinks/-/backlinks-1.0.2.tgz",
|
||||
"integrity": "sha512-iZ016m+fH8FbW4J7uPYEHGrgvAvKDCmZvx5OmmeqL8Cv14PQG/xuhz3FvfTA2Djxq9/pFURvYTWxh+oDDL3N2Q==",
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/backlinks/-/backlinks-1.0.3.tgz",
|
||||
"integrity": "sha512-9CKvHhWi7SSahr+dswf2MAZQOMl/1sNDnx8Z3rE6USkuXu+RKc1agKgIzP+wHV1ttojiI9kkYdZclT+QUMEhmA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@quartz-community/types": "^1.0.0",
|
||||
@@ -2420,9 +2420,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@quartz-community/bases-page": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/bases-page/-/bases-page-1.1.0.tgz",
|
||||
"integrity": "sha512-MBrGeHos2xSoDzgrytKIqEglx43YWxJK52YJIWHwkOod25Ii4eCH5Ox0HtpdgbOn7EnLPXtOV6xuQP9ysKWxSw==",
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/bases-page/-/bases-page-1.2.1.tgz",
|
||||
"integrity": "sha512-mONeRLsZTNPT5fOJfdlM1Uq97V7aGnxSRZaT0X4PsR5bbEAIjnBoVEdsYrYZWypm/c6go58/59fXbpeexKFsFw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@quartz-community/types": "^1.0.0",
|
||||
@@ -2450,9 +2450,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@quartz-community/breadcrumbs": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/breadcrumbs/-/breadcrumbs-1.0.2.tgz",
|
||||
"integrity": "sha512-ImEiYAFDcbayj9Yu7b7X6Yt7x9z4pAABZDwTUV5DBYfnQJmJWyuQpvqBgMHUBUgWbm9gyxT73tlXaHpLvsY56w==",
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/breadcrumbs/-/breadcrumbs-1.0.3.tgz",
|
||||
"integrity": "sha512-ciGV+xk98Nl5WqxTSyfyzDC+dWcSVjQcN2qN1GjnSKSeuPgX1/LQhpr1VHiDAVd3XpLMr/c7Gg19UkdMvBPgKQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@quartz-community/types": "^1.0.0",
|
||||
@@ -2472,9 +2472,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@quartz-community/canvas-page": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/canvas-page/-/canvas-page-1.0.2.tgz",
|
||||
"integrity": "sha512-F9kyp9PdSbUO2lKO1odINE29jA0aZw0XmIWW/p7zSGhRx4ZSvGjA+8thZHL6bIcyzjiG+09MndMebGSZiDmU1A==",
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/canvas-page/-/canvas-page-1.0.3.tgz",
|
||||
"integrity": "sha512-sUzjMZ+DKDYaN92zhUcVtuCodeFg8JvvoddeH3ZGBYdC8eXIqXhLYZx31mkBTjiLgx0Q4ACGduKpOYhkfTgrtQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@quartz-community/types": "^1.0.0",
|
||||
@@ -2532,9 +2532,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@quartz-community/comments": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/comments/-/comments-1.0.1.tgz",
|
||||
"integrity": "sha512-Q4mbmvD6jfJOdeBGzL3W9gPHIVpVVtnZQVrJmM35BFwJh7QtvOAEL/MsTwzYVPz4JRg0fugL39V8dtKL76OBDA==",
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/comments/-/comments-1.0.2.tgz",
|
||||
"integrity": "sha512-cHFjN7yn7rxgDzEOboM5viYOk1ex4Y/gIfDqN/BLNlqhPaZIkl2dq7RcYmkeVAz9kAJqNSj+WPQdVpB/2PGIGw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@quartz-community/types": "^1.0.0",
|
||||
@@ -2554,9 +2554,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@quartz-community/content-meta": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/content-meta/-/content-meta-1.0.1.tgz",
|
||||
"integrity": "sha512-FHoC0gV8bDbrefwy64VmjAjmKZqMxsC7xWpKb+Ks5b1iJLpLYjtJh3L6recVwjMnrCKFlxa1d/IEsNeJyqxndQ==",
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/content-meta/-/content-meta-1.0.2.tgz",
|
||||
"integrity": "sha512-DFiLi8MY4v+qQT4WOBFwXTGG46S0iSCDziJ0Vnc4T46iDhoj4NeQc6FowuaUuxf770tGX6rguVBJMPCZ3NGerQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@quartz-community/types": "^1.0.0",
|
||||
@@ -2576,9 +2576,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@quartz-community/content-page": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/content-page/-/content-page-1.0.2.tgz",
|
||||
"integrity": "sha512-+kbVhussK5n7sPc/7P5sSzLm6pDblYO3BCZ8asTxuHX43Hzv9jlj3LigphIDz/dvmHkjZNBMSdKHlvO5CcZRcg==",
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/content-page/-/content-page-1.0.3.tgz",
|
||||
"integrity": "sha512-zJJVACyJkwRull7GJOE57CcfjMNdYwATpY7aZQhhUCdu8NR4w0RJF3CfTc9QeQZ0mJL94A2KEKoa2gwbcy6UPg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@quartz-community/types": "^1.0.0",
|
||||
@@ -2627,9 +2627,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@quartz-community/darkmode": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/darkmode/-/darkmode-1.0.1.tgz",
|
||||
"integrity": "sha512-5HYQEMc1lM5P2PZazerq7sufLhcJ7WFURjQMXhJDqzhJOIz1I5csjd5UDGR/l/0vZayfrVzuWffgydOs8MwkYA==",
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/darkmode/-/darkmode-1.0.2.tgz",
|
||||
"integrity": "sha512-FCfR8bdg248Y1NJhN6TWVBENwFiJak3gwqmpof/GMeTXr6e76FPe2ggTTz66a+s9UQ/ZC3JKU9xpHQi0zcGhyQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@quartz-community/types": "^1.0.0",
|
||||
@@ -2671,9 +2671,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@quartz-community/encrypted-pages": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/encrypted-pages/-/encrypted-pages-1.0.1.tgz",
|
||||
"integrity": "sha512-KHBOEphODF5Lh+Ziv3jLar+k1DCU9Y7SRzBcDLWi/JJO99DQv29e6mwE2tZwcwom2cEUymOVjNpTJ7smEb/oTA==",
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/encrypted-pages/-/encrypted-pages-1.1.1.tgz",
|
||||
"integrity": "sha512-x+fFfXiurYn2BWgKuzwiZGTVq6osVbaUyIVoYXvNakwwIQQeuSGVyqWdA25bCK1nxYVRGXPS/d1emHrCLRgv9w==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@quartz-community/types": "^1.0.0",
|
||||
@@ -2697,9 +2697,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@quartz-community/explicit-publish": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/explicit-publish/-/explicit-publish-1.0.1.tgz",
|
||||
"integrity": "sha512-tM8CrgpEXZfT0/35hOZGl7QmqrAGYmqYZE0JA76Mh/b90Q8ewGZRCFPwnj3AQqIAfheGeSmhFFXHwnuf7biPTg==",
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/explicit-publish/-/explicit-publish-1.1.0.tgz",
|
||||
"integrity": "sha512-Xdo69D2x/VufWQviPOuQp/OkLQ8XVGwyt3KO+DN9/ablMvWAXSlYIA11pcP1Y4UgxBMzMhpZ4+BLZqTGlz1SRg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@quartz-community/types": "^1.0.0"
|
||||
@@ -2710,9 +2710,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@quartz-community/explorer": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/explorer/-/explorer-1.0.2.tgz",
|
||||
"integrity": "sha512-6u62zq/U28BBIbm9FHFheDCmfsqfCq+lEngd6JzhfBlXGn6n1I7q9vPIJ4qN/8DYLey556MjJMxh+QLPIDHuGg==",
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/explorer/-/explorer-1.0.3.tgz",
|
||||
"integrity": "sha512-NksQMrCmOL7xWfH7CCA9kXaQboLWgJfZ5wsDnFaIoZEvg8BzC6x2hipMi5dj/4dkitiZhDY3kjnGsGtc0oZUIw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@quartz-community/types": "^1.0.0",
|
||||
@@ -2753,9 +2753,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@quartz-community/folder-page": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/folder-page/-/folder-page-1.0.2.tgz",
|
||||
"integrity": "sha512-+h/9QFo+wEtweYyKEe4CZxJVILfC0V70z7rkGIjN9unWyxOkIB3PJh9Fw8oRDuZw07yF3HwOvAg9/bBar8q9DA==",
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/folder-page/-/folder-page-1.0.3.tgz",
|
||||
"integrity": "sha512-d2XN0NOSNXL9cwJqsllWXN7ugCAyCgx7AQl9ByJa3Qe/xvhqsyO84WPiS/BQOFBFlbRcozPHBN6tFZhiWrR5SQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@quartz-community/types": "^1.0.0",
|
||||
@@ -2779,9 +2779,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@quartz-community/footer": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/footer/-/footer-1.1.0.tgz",
|
||||
"integrity": "sha512-PUMTJiDAR4PrC4o745jrEhAwGRKETnYvcxS6OcKRzbOaW3N9q9ndEO4c7mur7CHccWhPdok3TwxRofz8fWTVDg==",
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/footer/-/footer-1.1.1.tgz",
|
||||
"integrity": "sha512-D1xMkN5kTHmTBH5mcJs1pjxo6wl2HDU/kE8F3kPbCciydAGq1APBnt59v8P+K0Cd8jVeTTtbXfYdZ463xEgKaQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@quartz-community/types": "^1.0.0",
|
||||
@@ -2801,9 +2801,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@quartz-community/github-flavored-markdown": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/github-flavored-markdown/-/github-flavored-markdown-2.1.0.tgz",
|
||||
"integrity": "sha512-E2K09rOgmhHFtF/9AbnoVXrI3v0Ww82ZIVCHQUWWM7fsuktn3DYmmVs2YhJk77tSbeqGW76ZY+gl4UgJ/U9Rxg==",
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/github-flavored-markdown/-/github-flavored-markdown-2.1.1.tgz",
|
||||
"integrity": "sha512-31SqmzJZfkGnEg5vkYEECp01G0W0d4Sr/QrzdYcn8hk9qmwxPNTXLZWnaDBt50NilTOoLLleZhHl+FsyACaa8Q==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@quartz-community/types": "^1.0.0",
|
||||
@@ -2823,9 +2823,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@quartz-community/graph": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/graph/-/graph-1.0.2.tgz",
|
||||
"integrity": "sha512-YmFoGizirmVkE9d66iLHgLrLgb7TYzCVaZT0kDwvh9J7/Kq8tUx/slIoFKuheJNr4gp7HGAxuNwx8WaLjqkXnQ==",
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/graph/-/graph-1.0.3.tgz",
|
||||
"integrity": "sha512-qfOiUpWUoZs/nIwV/iJgEjLWuWDR940O5mYBL2/dugbQHW05dDMhlF6hzrXgDlihnB000HDGtGk7LbL/ezdKkg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@quartz-community/types": "^1.0.0",
|
||||
@@ -2891,9 +2891,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@quartz-community/note-properties": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/note-properties/-/note-properties-1.1.3.tgz",
|
||||
"integrity": "sha512-ChzMZjvw47D+aTBDFOyaAJpfp/S+l25ndSoL8xJOf+DMgO5y+GioaEPmYRHjUOnbnZxc1/RcydSnyU68CU8yjA==",
|
||||
"version": "1.1.4",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/note-properties/-/note-properties-1.1.4.tgz",
|
||||
"integrity": "sha512-MTj7D4+CzmuYzZ8UwF8T5uzFf+JHoA2NzRCniuhug4h6KVxf3IRePqn5uVupjm/0Uzz2oeB7UX8Nr0hH0SNAdg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@quartz-community/types": "^1.0.0",
|
||||
@@ -2917,15 +2917,15 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@quartz-community/obsidian-flavored-markdown": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/obsidian-flavored-markdown/-/obsidian-flavored-markdown-2.1.1.tgz",
|
||||
"integrity": "sha512-6PvlLi1e3naAZwVRyKJ5lQW19/mHpbZIRFGN9wC+QMx+9gDiJzA/HP4uTwcPQxrH0OzyrwZ4qkR4AFizynr2Eg==",
|
||||
"version": "2.1.3",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/obsidian-flavored-markdown/-/obsidian-flavored-markdown-2.1.3.tgz",
|
||||
"integrity": "sha512-p5fls4M7ocUKrlF8MmfrlnNPEvBFZ5diVNVVkLsgTwCvzf19MrnczeKb3Q2yI2S1G2Xb0rXsq8kmF8faj+Q79A==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@quartz-community/rehype-obsidian": "^1.2.0",
|
||||
"@quartz-community/remark-obsidian": "^2.2.0",
|
||||
"@quartz-community/rehype-obsidian": "^1.3.0",
|
||||
"@quartz-community/remark-obsidian": "^2.2.1",
|
||||
"@quartz-community/types": "^1.1.0",
|
||||
"@quartz-community/utils": "^1.1.0",
|
||||
"@quartz-community/utils": "^1.2.0",
|
||||
"pele": "^1.13.0"
|
||||
},
|
||||
"engines": {
|
||||
@@ -2993,9 +2993,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@quartz-community/page-title": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/page-title/-/page-title-1.0.1.tgz",
|
||||
"integrity": "sha512-1KbSYyyAgsKeHWPv1/1IKmj1amSXSJZOV2Rdj44su8HPzW5CiUItam4Vnz0zNw7ElHq0/glNFS+r9RTuPE7sKw==",
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/page-title/-/page-title-1.0.2.tgz",
|
||||
"integrity": "sha512-nZir6dVcbp2NN+qr1Gz1e8FmM4NvrsyWzelx0EoXL0lxvIghDrfCW0epImz0NC39264enSS1fHu+b8CG7z8KeA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@quartz-community/types": "^1.0.0",
|
||||
@@ -3045,9 +3045,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@quartz-community/reader-mode": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/reader-mode/-/reader-mode-1.0.1.tgz",
|
||||
"integrity": "sha512-k3fynx1Cer6jKg+B55XmJJtO6UPAS9QCnSYefyZWTcuYyXiy+hKjaBFeeWJgBf3szCEswrQZG4DubyC5Si0FPg==",
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/reader-mode/-/reader-mode-1.0.2.tgz",
|
||||
"integrity": "sha512-Mm7llTF6erRk9ASrkcfYIKApfFf/yrBiYsPs+P8vx8qXaVziem/4e2G6wnT2EQQFUuYSSKklZ328V7rfN6fRRg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@quartz-community/types": "^1.0.0",
|
||||
@@ -3067,9 +3067,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@quartz-community/recent-notes": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/recent-notes/-/recent-notes-1.0.2.tgz",
|
||||
"integrity": "sha512-CWYHOBULovmqX5rxSBeuinkEPzBcQ2xVRT96y+D8JKDHtUK6IJr3dllYbgNK8sOp/akmAm5IuGWxXvfqJ75aUw==",
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/recent-notes/-/recent-notes-1.0.3.tgz",
|
||||
"integrity": "sha512-KxClnDJEixByDNwGbJfKqg/I5sHs1OwTAw+6UCIBcIJYeEszYD21F770NOrnaGQvrrBd5FITihVt8R48nsrSQQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@quartz-community/types": "^1.0.0",
|
||||
@@ -3089,18 +3089,18 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@quartz-community/rehype-obsidian": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/rehype-obsidian/-/rehype-obsidian-1.2.1.tgz",
|
||||
"integrity": "sha512-wuxPcG5ie4J7x7KMfOZMDSgyNKFJf6x6I+I6H4XaZ4WX4sPlEfMUDTvxBoHRHpstqfCRX5Hy73d/K9/rYAZdnw==",
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/rehype-obsidian/-/rehype-obsidian-1.3.0.tgz",
|
||||
"integrity": "sha512-62YFEr3NR/Z2G/wcq30/VVKTlT4RUKezWfwGTQkNC+9mAXcUb3gAwjgiUJwylXZQyZmBf+SZsCNmdhIb7CPh/g==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=22"
|
||||
}
|
||||
},
|
||||
"node_modules/@quartz-community/remark-obsidian": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/remark-obsidian/-/remark-obsidian-2.2.0.tgz",
|
||||
"integrity": "sha512-uSuUA3CA2ebAls7IXaevgQGqqbho1fR0lORKUTmhOTEUTYt8GBkl7ipaik4Y7x3q1LzUflejgFIGl/0XO83OGw==",
|
||||
"version": "2.2.1",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/remark-obsidian/-/remark-obsidian-2.2.1.tgz",
|
||||
"integrity": "sha512-Q18F/Px8db8Evf6uwPKz0RMhZNyrsH2Okzhr6FWcsm51fYgJR+SiO98/2fmXQ3wnqV2eeJC7ZMzi81SDjK8vrg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=22"
|
||||
@@ -3131,9 +3131,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@quartz-community/search": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/search/-/search-1.0.2.tgz",
|
||||
"integrity": "sha512-tZcFCkoOY7AdT0pDXUVkdhwEs5JLPuoVXy+TvdpUe2Mzy91fDKQQF0eN5UV4i2awZqLGka4vsQ4k33hZAZSi8A==",
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/search/-/search-1.0.3.tgz",
|
||||
"integrity": "sha512-jrmV6D91w948vJvvMTjD8L6nzxfCdqXRvk7tB+JpDwQtGzRI42Buq5psPZaWlcizyXC95MfGbUI9fTvnxJc7WQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@quartz-community/types": "^1.0.0",
|
||||
@@ -3153,9 +3153,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@quartz-community/spacer": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/spacer/-/spacer-1.0.1.tgz",
|
||||
"integrity": "sha512-fl/H/NaLdrHxP3R5VtABcaHYGshBNxmEIhAYxeAU+/q0ork5OCHDyxdUd+ZZYWOvK/KD42vBbAQEfzkYVuM9+Q==",
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/spacer/-/spacer-1.0.2.tgz",
|
||||
"integrity": "sha512-AET+6OOYyMGbHGbEvZvBzkLiXbTBX4odJ2aWGde1HrLMdE/IJzL1HV2jbNPhC1AilA8gQf3fpNNxaimoSldyRQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@quartz-community/types": "^1.0.0"
|
||||
@@ -3174,9 +3174,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@quartz-community/stacked-pages": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/stacked-pages/-/stacked-pages-1.0.2.tgz",
|
||||
"integrity": "sha512-0QxMNeiF5AnZ0fnQxFLcqs8GJCVywIoGjK+YNhN1TOk3p6MIDO0I+AdTbJ+QlZ5JiqXnNZkNoAnQJNXVCEiIAg==",
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/stacked-pages/-/stacked-pages-1.0.3.tgz",
|
||||
"integrity": "sha512-wdILZkQpYL9k490iXzNRkWtrDyRBxCfs+rqz3JUWPyMAq3ztlyH0UtDoyB+zDUN9XryPqmTf0b3rtiKlQLiJFg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@quartz-community/types": "^1.0.0",
|
||||
@@ -3200,9 +3200,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@quartz-community/syntax-highlighting": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/syntax-highlighting/-/syntax-highlighting-1.0.2.tgz",
|
||||
"integrity": "sha512-G2/auy9ilQ0vLEZyi5C5/BZe9Us+Ds89wnSfi5z4ciBS3rWD1dtLTbnQQyWTLd1hIzCFOtVsPTM1N+2hkVTgSQ==",
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/syntax-highlighting/-/syntax-highlighting-1.0.3.tgz",
|
||||
"integrity": "sha512-rD3cNLNCytlUyRR7b2emBmEchMGiNqNoAsZlhgqqQjez523lDMl9Qhxpuw6EgnAYn8uEWOTnOZF5c+jTSkEF+A==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@quartz-community/types": "^1.0.0"
|
||||
@@ -3225,9 +3225,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@quartz-community/table-of-contents": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/table-of-contents/-/table-of-contents-1.0.2.tgz",
|
||||
"integrity": "sha512-lOwx5MwrDfDuk6rzBZdyToAZOiV6raN8JJVveSxMik8+QjdGGYA1Ery/A/HTib2riDEJZU6EgShlrYlrGpNCzg==",
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/table-of-contents/-/table-of-contents-1.0.3.tgz",
|
||||
"integrity": "sha512-BktvbmiyCRZ/iCZ6qQNXo+4amburwcGn2hmsiL4QN7Keruo8EuZPvLaXtrO4E25DO5XeMGovgbOoFNMKIia1yA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@quartz-community/types": "^1.0.0",
|
||||
@@ -3247,9 +3247,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@quartz-community/tag-list": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/tag-list/-/tag-list-1.0.2.tgz",
|
||||
"integrity": "sha512-Dr4QhM/h7tV0oNjhAq7Gpto1aLiMPplwBQ6CGUs15qhW3p9je3t0qhUQQVboXMXlw1u5NZiKj/NqoDnoZSMG9w==",
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/tag-list/-/tag-list-1.0.3.tgz",
|
||||
"integrity": "sha512-pwbbFAfdOL/xVG6Q7e+G0plC/BHHOLcpwssRn+77KxBcJPC2Z6fMqLCz8tW10T62/KoE/ig50S7iZbx36e+Njg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@quartz-community/types": "^1.0.0",
|
||||
@@ -3269,9 +3269,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@quartz-community/tag-page": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/tag-page/-/tag-page-1.0.2.tgz",
|
||||
"integrity": "sha512-GkPItFn82SA6h6tW6AZ3EdavsgkLd38ado8Gi1lm0wMbtHIJCFLlgZqYoReLTg32VGGT2gAvzn+hLsuuTV/LTQ==",
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/tag-page/-/tag-page-1.0.3.tgz",
|
||||
"integrity": "sha512-2D9w5gXKxERPny9uFb64iOG+DqcAmieYDu+x0DFPULh/UTlYm6xk2adwrTfi6lFouzl/UoHRmHxjumC3zwNvWQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@quartz-community/types": "^1.0.0",
|
||||
@@ -3295,9 +3295,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@quartz-community/types": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/types/-/types-1.2.0.tgz",
|
||||
"integrity": "sha512-82L+hallWn9LCMw9kFUWJhAGwlTd4rT2KxxL8B7IAWTEvj/20StWsuC01Mbfk5hLhd8jAHGgj1WHb0u/cdUXEA==",
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/types/-/types-1.3.0.tgz",
|
||||
"integrity": "sha512-tdLWSv+XWqHGiuo77etvXkd2XO1S12NlUUbiC9o+o9BWgW7E/lcNl6A+I8c9uKbAj9CrIn7suK7z9154rlSwlQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"unified": "^11.0.5",
|
||||
@@ -3321,13 +3321,12 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@quartz-community/unlisted-pages": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/unlisted-pages/-/unlisted-pages-1.0.1.tgz",
|
||||
"integrity": "sha512-X7hlz1/i0CJMp13Px3p6tsJYBsAOFAWyAKx9hvospPDUnpMVFcNbTILGqrGKepCcgq8TQQ8GEIZdvNccxWmsPQ==",
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/unlisted-pages/-/unlisted-pages-1.1.0.tgz",
|
||||
"integrity": "sha512-Gi67xF7AIC860/Glwbi+Ewbbnvox3A3MPsTi2Dz25xuaepZLfnQAwCT4ZgAsy55y4wyxxZG8DBHjkOgRyd9PXQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@quartz-community/types": "^1.0.0",
|
||||
"@quartz-community/utils": "^1.0.0"
|
||||
"@quartz-community/types": "^1.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=22",
|
||||
@@ -3343,9 +3342,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@quartz-community/utils": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/utils/-/utils-1.1.1.tgz",
|
||||
"integrity": "sha512-iHjEOlbpqznut9YkoflXxd2Bl5TaBcMFwIouRxp2HTBcbCQbmHtAsL3sdLheC1YeM9bMxeFLAN2b7rIBR2r/og==",
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@quartz-community/utils/-/utils-1.2.0.tgz",
|
||||
"integrity": "sha512-X32uBfhfNACQw2Ciw6F0XQ9qSoTMQeh78/2ZEj8cYuOk7VTowNf0dpjtSDKAxs1co6aSpIEcDZBIG6p953UPiQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@quartz-community/types": "^1.0.0"
|
||||
|
||||
+31
-31
@@ -44,46 +44,46 @@
|
||||
"@myriaddreamin/rehype-typst": "^0.7.0",
|
||||
"@napi-rs/simple-git": "1.1.0",
|
||||
"@quartz-community/alias-redirects": "^1.0.2",
|
||||
"@quartz-community/article-title": "^1.0.1",
|
||||
"@quartz-community/backlinks": "^1.0.2",
|
||||
"@quartz-community/bases-page": "^1.1.0",
|
||||
"@quartz-community/breadcrumbs": "^1.0.2",
|
||||
"@quartz-community/canvas-page": "^1.0.2",
|
||||
"@quartz-community/article-title": "^1.0.2",
|
||||
"@quartz-community/backlinks": "^1.0.3",
|
||||
"@quartz-community/bases-page": "^1.2.1",
|
||||
"@quartz-community/breadcrumbs": "^1.0.3",
|
||||
"@quartz-community/canvas-page": "^1.0.3",
|
||||
"@quartz-community/citations": "^1.0.1",
|
||||
"@quartz-community/cname": "^1.0.1",
|
||||
"@quartz-community/comments": "^1.0.1",
|
||||
"@quartz-community/content-meta": "^1.0.1",
|
||||
"@quartz-community/content-page": "^1.0.2",
|
||||
"@quartz-community/comments": "^1.0.2",
|
||||
"@quartz-community/content-meta": "^1.0.2",
|
||||
"@quartz-community/content-page": "^1.0.3",
|
||||
"@quartz-community/created-modified-date": "^1.0.2",
|
||||
"@quartz-community/darkmode": "^1.0.1",
|
||||
"@quartz-community/darkmode": "^1.0.2",
|
||||
"@quartz-community/description": "^1.0.2",
|
||||
"@quartz-community/encrypted-pages": "^1.0.1",
|
||||
"@quartz-community/explicit-publish": "^1.0.1",
|
||||
"@quartz-community/explorer": "^1.0.2",
|
||||
"@quartz-community/encrypted-pages": "^1.1.1",
|
||||
"@quartz-community/explicit-publish": "^1.1.0",
|
||||
"@quartz-community/explorer": "^1.0.3",
|
||||
"@quartz-community/favicon": "^1.0.1",
|
||||
"@quartz-community/folder-page": "^1.0.2",
|
||||
"@quartz-community/footer": "^1.1.0",
|
||||
"@quartz-community/github-flavored-markdown": "^2.1.0",
|
||||
"@quartz-community/graph": "^1.0.2",
|
||||
"@quartz-community/folder-page": "^1.0.3",
|
||||
"@quartz-community/footer": "^1.1.1",
|
||||
"@quartz-community/github-flavored-markdown": "^2.1.1",
|
||||
"@quartz-community/graph": "^1.0.3",
|
||||
"@quartz-community/hard-line-breaks": "^1.1.0",
|
||||
"@quartz-community/latex": "^1.0.1",
|
||||
"@quartz-community/note-properties": "^1.1.3",
|
||||
"@quartz-community/obsidian-flavored-markdown": "^2.1.1",
|
||||
"@quartz-community/note-properties": "^1.1.4",
|
||||
"@quartz-community/obsidian-flavored-markdown": "^2.1.3",
|
||||
"@quartz-community/og-image": "^1.1.1",
|
||||
"@quartz-community/ox-hugo": "^1.0.1",
|
||||
"@quartz-community/page-title": "^1.0.1",
|
||||
"@quartz-community/page-title": "^1.0.2",
|
||||
"@quartz-community/quartz-fonts": "^1.0.2",
|
||||
"@quartz-community/reader-mode": "^1.0.1",
|
||||
"@quartz-community/recent-notes": "^1.0.2",
|
||||
"@quartz-community/reader-mode": "^1.0.2",
|
||||
"@quartz-community/recent-notes": "^1.0.3",
|
||||
"@quartz-community/roam": "^1.0.1",
|
||||
"@quartz-community/search": "^1.0.2",
|
||||
"@quartz-community/spacer": "^1.0.1",
|
||||
"@quartz-community/stacked-pages": "^1.0.2",
|
||||
"@quartz-community/syntax-highlighting": "^1.0.2",
|
||||
"@quartz-community/table-of-contents": "^1.0.2",
|
||||
"@quartz-community/tag-list": "^1.0.2",
|
||||
"@quartz-community/tag-page": "^1.0.2",
|
||||
"@quartz-community/unlisted-pages": "^1.0.1",
|
||||
"@quartz-community/search": "^1.0.3",
|
||||
"@quartz-community/spacer": "^1.0.2",
|
||||
"@quartz-community/stacked-pages": "^1.0.3",
|
||||
"@quartz-community/syntax-highlighting": "^1.0.3",
|
||||
"@quartz-community/table-of-contents": "^1.0.3",
|
||||
"@quartz-community/tag-list": "^1.0.3",
|
||||
"@quartz-community/tag-page": "^1.0.3",
|
||||
"@quartz-community/unlisted-pages": "^1.1.0",
|
||||
"@quartz-themes/core": "^2.0.1",
|
||||
"ansi-truncate": "^1.4.0",
|
||||
"async-mutex": "^0.5.0",
|
||||
@@ -124,8 +124,8 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@changesets/cli": "^2.29.2",
|
||||
"@quartz-community/types": "^1.2.0",
|
||||
"@quartz-community/utils": "^1.1.1",
|
||||
"@quartz-community/types": "^1.3.0",
|
||||
"@quartz-community/utils": "^1.2.0",
|
||||
"@types/hast": "^3.0.4",
|
||||
"@types/js-yaml": "^4.0.9",
|
||||
"@types/node": "^26.5.1",
|
||||
|
||||
+6
-1
@@ -46,7 +46,12 @@ function updateSlugs(ctx: BuildCtx, allFiles: string[]): void {
|
||||
? collectPermalinks({
|
||||
files: allFiles.filter((fp) => fp.endsWith(".md")),
|
||||
permalinkOf: (fp) => {
|
||||
const source = fs.readFileSync(path.join(ctx.argv.directory, fp))
|
||||
let source: Buffer
|
||||
try {
|
||||
source = fs.readFileSync(path.join(ctx.argv.directory, fp))
|
||||
} catch {
|
||||
return undefined // an unreadable file is reported when the file is parsed
|
||||
}
|
||||
if (!source.includes("permalink")) return undefined
|
||||
try {
|
||||
return readFrontmatterData(source, options).permalink
|
||||
|
||||
@@ -428,6 +428,8 @@ export async function handleBuild(argv) {
|
||||
`${styleText("red", "Failed to build Quartz.")} Check for syntax errors in your configuration or plugins.`,
|
||||
)
|
||||
console.log(`Reason: ${styleText("gray", err.message ?? String(err))}`)
|
||||
// stop esbuild's child process first: it shares our stderr and outlives us otherwise
|
||||
void esbuild.stop()
|
||||
process.exit(1)
|
||||
})
|
||||
release()
|
||||
|
||||
@@ -183,6 +183,46 @@ describe("renderTranscludes", () => {
|
||||
assert.ok(!secondText.includes("Circular transclusion"), "should not show circular warning")
|
||||
})
|
||||
|
||||
test("a header transclusion matches a heading's Obsidian-anchor alias", () => {
|
||||
const root: Root = {
|
||||
type: "root",
|
||||
children: [makeTranscludeBlockquote("target", "#colon-unspaced")],
|
||||
}
|
||||
const targetHtml: Root = {
|
||||
type: "root",
|
||||
children: [
|
||||
{
|
||||
type: "element",
|
||||
tagName: "h2",
|
||||
properties: { id: "colonunspaced" },
|
||||
children: [
|
||||
{
|
||||
type: "element",
|
||||
tagName: "span",
|
||||
properties: { id: "colon-unspaced", className: ["heading-alias"] },
|
||||
children: [],
|
||||
},
|
||||
{ type: "text", value: "Colon:unspaced" },
|
||||
],
|
||||
},
|
||||
{
|
||||
type: "element",
|
||||
tagName: "p",
|
||||
properties: {},
|
||||
children: [{ type: "text", value: "Section text" }],
|
||||
},
|
||||
],
|
||||
}
|
||||
renderTranscludes(
|
||||
root,
|
||||
cfg,
|
||||
"current" as FullSlug,
|
||||
makeComponentData([makePageData("target", targetHtml)]) as QuartzComponentProps,
|
||||
new Set<FullSlug>(["current" as FullSlug]),
|
||||
)
|
||||
assert.ok(JSON.stringify((root.children[0] as Element).children).includes("Section text"))
|
||||
})
|
||||
|
||||
test("detects actual circular transclusion (A -> B -> A)", () => {
|
||||
// Page A embeds B, and B's htmlAst contains a transclusion of A
|
||||
const bTranscludesA = makeTranscludeBlockquote("pageA")
|
||||
|
||||
@@ -31,6 +31,25 @@ interface RenderComponents {
|
||||
}
|
||||
|
||||
const headerRegex = new RegExp(/h[1-6]/)
|
||||
|
||||
/**
|
||||
* Whether a heading answers to `id`: its own id, or the id of a `span.heading-alias` inside it.
|
||||
* GitHubFlavoredMarkdown adds that alias when the anchor Obsidian writes for a heading (`:`, `|`,
|
||||
* `^`, `#` and `\` become spaces) slugs differently, e.g. `![[note#Colon unspaced]]` for
|
||||
* `## Colon:unspaced`.
|
||||
*/
|
||||
function headingHasId(heading: Element, id: string): boolean {
|
||||
if (heading.properties?.id === id) return true
|
||||
const hasAlias = (el: Element): boolean =>
|
||||
el.children.some(
|
||||
(child) =>
|
||||
child.type === "element" &&
|
||||
((child.properties?.id === id &&
|
||||
([] as unknown[]).concat(child.properties?.className ?? []).includes("heading-alias")) ||
|
||||
hasAlias(child)),
|
||||
)
|
||||
return hasAlias(heading)
|
||||
}
|
||||
export function pageResources(
|
||||
baseDir: FullSlug | RelativeURL,
|
||||
staticResources: StaticResources,
|
||||
@@ -231,7 +250,7 @@ export function renderTranscludes(
|
||||
const depth = Number(htmlEl.tagName.substring(1))
|
||||
|
||||
if (startIdx === undefined || startDepth === undefined) {
|
||||
if (htmlEl.properties?.id === blockRef) {
|
||||
if (headingHasId(htmlEl, blockRef)) {
|
||||
startIdx = i
|
||||
startDepth = depth
|
||||
}
|
||||
|
||||
@@ -229,7 +229,7 @@ describe("frontmatter built-in", () => {
|
||||
readFrontmatterData(`---\n{ ran: (globalThis.__quartzFrontmatterRan = true) }\n---\n`, {
|
||||
language: lang as "yaml",
|
||||
}),
|
||||
/JavaScript frontmatter/,
|
||||
/unsupported `language` option/,
|
||||
)
|
||||
}
|
||||
assert.strictEqual(g.__quartzFrontmatterRan, undefined)
|
||||
@@ -242,6 +242,31 @@ describe("frontmatter built-in", () => {
|
||||
)
|
||||
})
|
||||
|
||||
test("an unsupported language option is a configuration error, not a content error", () => {
|
||||
assert.throws(
|
||||
() => readFrontmatterData("---\ntitle: a\n---\n", { language: "json" as "yaml" }),
|
||||
(err: Error) =>
|
||||
!isContentError(err) && /unsupported `language` option "json"/.test(err.message),
|
||||
)
|
||||
})
|
||||
|
||||
test("frontmatter holding a single value or a list instead of properties is a content error", () => {
|
||||
for (const source of [
|
||||
"---\nhello\n---\nbody\n",
|
||||
"---\n42\n---\n",
|
||||
"---\n- a\n- b\n---\nbody\n",
|
||||
]) {
|
||||
assert.throws(
|
||||
() => readFrontmatterData(source),
|
||||
(err: Error) => isContentError(err) && /expected properties/.test(err.message),
|
||||
)
|
||||
}
|
||||
// empty frontmatter keeps working
|
||||
assert.deepStrictEqual(readFrontmatterData("---\n---\nbody\n"), {})
|
||||
assert.deepStrictEqual(readFrontmatterData("---\n# just a comment\n---\nbody\n"), {})
|
||||
assert.deepStrictEqual(readFrontmatterData("---\nnull\n---\n"), {})
|
||||
})
|
||||
|
||||
test("a permalink is the page's address, not an alias (Obsidian Publish)", () => {
|
||||
const data: Record<string, unknown> = { permalink: "short", aliases: ["old-name"] }
|
||||
assert.deepStrictEqual(normalizeFrontmatter(data, "x").aliases, ["old-name"])
|
||||
@@ -336,6 +361,41 @@ describe("links built-in", () => {
|
||||
assert.strictEqual(els[1].properties.src, "../../media/a.mp4")
|
||||
})
|
||||
|
||||
// Obsidian 1.15.0 (remark-obsidian 2.2.1's triage, re-probed): a path that is not valid
|
||||
// percent-encoding names no file, so the link is external; `x:y` has a scheme, `../x:y` doesn't
|
||||
test("links Obsidian reads as external", () => {
|
||||
const { els } = run([a("%zz"), a("a%E2.md"), a("x:y"), a("../x:y")], "sub/note", {}, ["xy"])
|
||||
const classes = els.filter((e) => e.tagName === "a").map((e) => e.properties.className)
|
||||
assert.deepStrictEqual(
|
||||
classes.map((c) => (c as string[])[0]),
|
||||
["external", "external", "external", "internal"],
|
||||
)
|
||||
})
|
||||
|
||||
test("an image of a missing file without alt text shows its decoded path", () => {
|
||||
const img = (src: string, alt?: string): Element => ({
|
||||
type: "element",
|
||||
tagName: "img",
|
||||
properties: alt === undefined ? { src } : { src, alt },
|
||||
children: [],
|
||||
})
|
||||
const { els } = run(
|
||||
[
|
||||
img("missing%20pic.png"),
|
||||
img("missing%20image.png", "alt"),
|
||||
img("pic.png"),
|
||||
img("/static/x.png"),
|
||||
],
|
||||
"page",
|
||||
{ markdownLinkResolution: "absolute" },
|
||||
["page", "pic.png"],
|
||||
)
|
||||
assert.deepStrictEqual(
|
||||
els.map((e) => e.properties.alt),
|
||||
["missing pic.png", "alt", undefined, undefined],
|
||||
)
|
||||
})
|
||||
|
||||
test("disableBrokenWikilinks adds a broken class to missing targets", () => {
|
||||
const { els } = run([a("missing")], "page", { disableBrokenWikilinks: true }, ["page"])
|
||||
assert.ok((els[0].properties.className as string[]).includes("broken"))
|
||||
|
||||
@@ -146,10 +146,17 @@ export function readFrontmatterData(
|
||||
source: Buffer | string,
|
||||
options: Pick<FrontmatterConfig, "delimiters" | "language"> = {},
|
||||
): Record<string, unknown> {
|
||||
const language = options.language ?? frontmatterDefaults.language
|
||||
if (language !== "yaml" && language !== "toml") {
|
||||
// a configuration mistake, not a problem in the file: no ContentError
|
||||
throw new Error(
|
||||
`Frontmatter: unsupported \`language\` option ${JSON.stringify(language)} (use "yaml" or "toml")`,
|
||||
)
|
||||
}
|
||||
try {
|
||||
const { data } = matter(Buffer.isBuffer(source) ? source : Buffer.from(source), {
|
||||
delimiters: options.delimiters ?? frontmatterDefaults.delimiters,
|
||||
language: options.language ?? frontmatterDefaults.language,
|
||||
language,
|
||||
engines: {
|
||||
yaml: (s) => yaml.load(s, { schema: yaml.JSON_SCHEMA }) as object,
|
||||
toml: (s) => toml.parse(s) as object,
|
||||
@@ -157,6 +164,14 @@ export function readFrontmatterData(
|
||||
js: refuseJavaScript,
|
||||
},
|
||||
})
|
||||
// YAML/TOML can hold a single value (`--- hello ---`) or a list (`- a`); properties are
|
||||
// key/value pairs
|
||||
if (typeof data !== "object" || data === null || Array.isArray(data)) {
|
||||
const kind = Array.isArray(data) ? "list" : typeof data
|
||||
throw new ContentError(
|
||||
`Invalid frontmatter: expected properties (\`key: value\` lines), got a ${kind} (${JSON.stringify(data)})`,
|
||||
)
|
||||
}
|
||||
return data
|
||||
} catch (err) {
|
||||
if (err instanceof ContentError) throw err
|
||||
|
||||
@@ -8,6 +8,7 @@ import { LinksConfig } from "../../cfg"
|
||||
import {
|
||||
FullSlug,
|
||||
RelativeURL,
|
||||
linkPathDecodes,
|
||||
SimpleSlug,
|
||||
TransformOptions,
|
||||
resolveRelative,
|
||||
@@ -46,7 +47,9 @@ export const legacyCrawlLinksDefaults: Partial<LinksConfig> = {
|
||||
}
|
||||
|
||||
const isAbsolute = isAbsoluteUrl as (url: string, options?: { httpOnly?: boolean }) => boolean
|
||||
const isExternalUrl = (url: string) => isAbsolute(url, { httpOnly: false })
|
||||
// As in Obsidian: a URL with a scheme (`x:y`, but not `../x:y`), or a link whose path is not valid
|
||||
// percent-encoding (`%zz`, `a%E2.md`), which names no file
|
||||
const isExternalUrl = (url: string) => isAbsolute(url, { httpOnly: false }) || !linkPathDecodes(url)
|
||||
|
||||
const EXTERNAL_ICON_PATH =
|
||||
"M320 0H288V64h32 82.7L201.4 265.4 178.7 288 224 333.3l22.6-22.6L448 109.3V192v32h64V192 32 0H480 320zM32 32H0V64 480v32H32 456h32V480 352 320H424v32 96H64V96h96 32V32H160 32z"
|
||||
@@ -175,8 +178,20 @@ export const Links: QuartzTransformerPlugin<LinksConfig> = (userOpts) => {
|
||||
typeof node.properties.src === "string"
|
||||
) {
|
||||
if (opts.lazyLoad) node.properties.loading = "lazy"
|
||||
if (!isExternalUrl(node.properties.src)) {
|
||||
node.properties.src = resolveLink(node.properties.src as RelativeURL)
|
||||
const src = node.properties.src
|
||||
if (!isExternalUrl(src)) {
|
||||
node.properties.src = resolveLink(src as RelativeURL)
|
||||
// An embed of a file the site doesn't have: Obsidian shows its path, percent-decoded
|
||||
// (`` → “missing pic.png”). The image shows its alt text, so
|
||||
// an image without one gets the path; an author's alt text is kept.
|
||||
const target =
|
||||
node.tagName === "img" && !node.properties.alt && !src.startsWith("#")
|
||||
? canonicalSlug(node.properties.src as string, curSlug)
|
||||
: undefined
|
||||
// (quartz/static is served at static/ but holds no content files)
|
||||
if (target && !target.startsWith("static/") && !ctx.allSlugs.includes(target)) {
|
||||
node.properties.alt = decodeURI(splitAnchor(src)[0])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import fs from "node:fs"
|
||||
import os from "node:os"
|
||||
import path from "node:path"
|
||||
import { Assets } from "./assets"
|
||||
import { isContentError } from "../../util/pluginErrors"
|
||||
import type { StaticResources } from "../../util/resources"
|
||||
import type { BuildCtx } from "../../util/ctx"
|
||||
import type { ChangeEvent } from "../types"
|
||||
@@ -52,3 +53,53 @@ describe("Assets.partialEmit", () => {
|
||||
await assert.doesNotReject(consumeDelete(output, changeEvent))
|
||||
})
|
||||
})
|
||||
|
||||
describe("Assets.emit", () => {
|
||||
const emitAll = async (directory: string, output: string) => {
|
||||
const ctx = {
|
||||
argv: { directory, output },
|
||||
cfg: { configuration: { ignorePatterns: [] }, plugins: { pageTypes: [] } },
|
||||
} as unknown as BuildCtx
|
||||
const emitted = Assets().emit(ctx, [], {} as StaticResources)
|
||||
const files: unknown[] = []
|
||||
for await (const file of emitted as AsyncIterable<unknown>) files.push(file)
|
||||
return files
|
||||
}
|
||||
const tempDir = async () => {
|
||||
const dir = await fs.promises.mkdtemp(path.join(os.tmpdir(), "quartz-assets-"))
|
||||
tempDirs.push(dir)
|
||||
return dir
|
||||
}
|
||||
// chmod can't take read/write access away from root, and Windows ignores POSIX permission bits
|
||||
const noPermissions = process.getuid?.() === 0 || process.platform === "win32"
|
||||
|
||||
test("an unreadable asset is a content error", { skip: noPermissions }, async () => {
|
||||
const content = await tempDir()
|
||||
const output = await tempDir()
|
||||
const asset = path.join(content, "secret.png")
|
||||
await fs.promises.writeFile(asset, "x")
|
||||
await fs.promises.chmod(asset, 0o000)
|
||||
try {
|
||||
await assert.rejects(
|
||||
emitAll(content, output),
|
||||
(err: Error) =>
|
||||
isContentError(err) &&
|
||||
err.message === "Cannot read `secret.png`: permission denied (EACCES)",
|
||||
)
|
||||
} finally {
|
||||
await fs.promises.chmod(asset, 0o644)
|
||||
}
|
||||
})
|
||||
|
||||
test("an unwritable output is not a content error", { skip: noPermissions }, async () => {
|
||||
const content = await tempDir()
|
||||
const output = await tempDir()
|
||||
await fs.promises.writeFile(path.join(content, "image.png"), "x")
|
||||
await fs.promises.chmod(output, 0o555)
|
||||
try {
|
||||
await assert.rejects(emitAll(content, output), (err: Error) => !isContentError(err))
|
||||
} finally {
|
||||
await fs.promises.chmod(output, 0o755)
|
||||
}
|
||||
})
|
||||
})
|
||||
@@ -5,6 +5,7 @@ import path from "path"
|
||||
import fs from "fs"
|
||||
import { glob } from "../../util/glob"
|
||||
import { Argv, BuildCtx } from "../../util/ctx"
|
||||
import { unreadableFileError } from "../../util/pluginErrors"
|
||||
import { QuartzConfig } from "../../cfg"
|
||||
import { visit } from "unist-util-visit"
|
||||
import { Element } from "hast"
|
||||
@@ -99,10 +100,25 @@ const copyFile = async (argv: Argv, fp: FilePath) => {
|
||||
const dir = path.dirname(dest) as FilePath
|
||||
await fs.promises.mkdir(dir, { recursive: true })
|
||||
|
||||
await fs.promises.copyFile(src, dest)
|
||||
try {
|
||||
await fs.promises.copyFile(src, dest)
|
||||
} catch (err) {
|
||||
throw await unreadableSource(err, src, fp)
|
||||
}
|
||||
return dest
|
||||
}
|
||||
|
||||
/** A content file Quartz can't read (no permission, …) is a content problem, not a Quartz bug. */
|
||||
async function unreadableSource(err: unknown, src: FilePath, fp: FilePath): Promise<unknown> {
|
||||
if ((err as NodeJS.ErrnoException | null)?.code === "ENOENT") return err
|
||||
try {
|
||||
await fs.promises.access(src, fs.constants.R_OK)
|
||||
return err // the source is readable: the output side failed
|
||||
} catch {
|
||||
return unreadableFileError(err, fp) ?? err
|
||||
}
|
||||
}
|
||||
|
||||
export const Assets: QuartzEmitterPlugin = () => {
|
||||
return {
|
||||
name: "Assets",
|
||||
|
||||
@@ -5,15 +5,20 @@ import os from "os"
|
||||
import path from "path"
|
||||
import {
|
||||
collectComponents,
|
||||
folderTrie,
|
||||
generateVirtualPages,
|
||||
pageOutputPath,
|
||||
processVirtualPageHtml,
|
||||
referencesByTarget,
|
||||
removeStalePageOutput,
|
||||
resolveLayout,
|
||||
} from "./dispatcher"
|
||||
import { QuartzPageTypePluginInstance } from "../types"
|
||||
import { QuartzComponent } from "../../components/types"
|
||||
import { FilePath, FullSlug } from "../../util/path"
|
||||
import { FilePath, FullSlug, SimpleSlug } from "../../util/path"
|
||||
import { Root as HtmlRoot } from "hast"
|
||||
import { BuildCtx } from "../../util/ctx"
|
||||
import { defaultProcessedContent } from "../vfile"
|
||||
|
||||
const StubA: QuartzComponent = (() => null) as unknown as QuartzComponent
|
||||
const StubB: QuartzComponent = (() => null) as unknown as QuartzComponent
|
||||
@@ -277,3 +282,229 @@ describe("generateVirtualPages", () => {
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
describe("folders of virtual pages (#2576)", () => {
|
||||
const makeCtx = () => ({ cfg: { configuration: {} }, virtualPages: [] }) as unknown as BuildCtx
|
||||
const page = (slug: string) => ({ slug: slug as FullSlug, title: slug, data: {} })
|
||||
const note = (slug: string) =>
|
||||
defaultProcessedContent({
|
||||
slug: slug as FullSlug,
|
||||
relativePath: `${slug}.md` as FilePath,
|
||||
filePath: `content/${slug}.md` as FilePath,
|
||||
frontmatter: { title: slug },
|
||||
})[1].data
|
||||
|
||||
test("a page type sees the virtual pages of higher-priority page types in ctx.virtualPages", async () => {
|
||||
const ctx = makeCtx()
|
||||
let seen: string[] = []
|
||||
await generateVirtualPages(
|
||||
[
|
||||
makePageType({ name: "bases", generate: () => [page("trips/map.base")] }),
|
||||
makePageType({
|
||||
name: "folders",
|
||||
generate: ({ ctx }) => {
|
||||
seen = ctx.virtualPages.map(([, vfile]) => vfile.data.slug!)
|
||||
return []
|
||||
},
|
||||
}),
|
||||
],
|
||||
[],
|
||||
ctx,
|
||||
{ head: StubHead },
|
||||
{},
|
||||
)
|
||||
assert.deepStrictEqual(seen, ["trips/map.base"])
|
||||
})
|
||||
|
||||
test("only pages of page types that render files are file-backed", async () => {
|
||||
const entries = await generateVirtualPages(
|
||||
[
|
||||
makePageType({
|
||||
name: "bases",
|
||||
fileExtensions: [".base"],
|
||||
generate: () => [page("trips/map.base")],
|
||||
}),
|
||||
makePageType({ name: "tags", generate: () => [page("tags/a")] }),
|
||||
],
|
||||
[],
|
||||
makeCtx(),
|
||||
{ head: StubHead },
|
||||
{},
|
||||
)
|
||||
assert.deepStrictEqual(
|
||||
entries.map((e) => [e.vpSlug, e.fileBacked]),
|
||||
[
|
||||
["trips/map.base", true],
|
||||
["tags/a", false],
|
||||
],
|
||||
)
|
||||
})
|
||||
|
||||
test("the folder trie holds file-backed virtual pages, not tag or folder pages", async () => {
|
||||
const entries = await generateVirtualPages(
|
||||
[
|
||||
makePageType({
|
||||
name: "bases",
|
||||
fileExtensions: [".base"],
|
||||
generate: () => [page("trips/map.base"), page("mixed/board.base")],
|
||||
}),
|
||||
makePageType({ name: "tags", generate: () => [page("tags/a")] }),
|
||||
makePageType({ name: "folders", generate: () => [page("trips/index")] }),
|
||||
],
|
||||
[],
|
||||
makeCtx(),
|
||||
{ head: StubHead },
|
||||
{},
|
||||
)
|
||||
const trie = folderTrie([note("mixed/note")], entries)
|
||||
const children = (folder: string) =>
|
||||
trie
|
||||
.findNode([folder, "index"])
|
||||
?.children.map((c) => c.slug)
|
||||
.sort()
|
||||
assert.deepStrictEqual(children("trips"), ["trips/map.base"])
|
||||
assert.deepStrictEqual(children("mixed"), ["mixed/board.base", "mixed/note"])
|
||||
assert.strictEqual(trie.findNode(["tags", "index"]), undefined)
|
||||
assert.strictEqual(trie.findNode(["trips", "index"])?.data, null)
|
||||
})
|
||||
})
|
||||
|
||||
describe("publish filters on pages that stand for files (bases-page#11)", () => {
|
||||
const note = (slug: string, links: string[], frontmatter: Record<string, unknown> = {}) =>
|
||||
defaultProcessedContent({
|
||||
slug: slug as FullSlug,
|
||||
relativePath: `${slug}.md` as FilePath,
|
||||
links: links as SimpleSlug[],
|
||||
frontmatter: { title: slug, ...frontmatter },
|
||||
})
|
||||
const page = (slug: string, data: Record<string, unknown> = {}) => ({
|
||||
slug: slug as FullSlug,
|
||||
title: slug,
|
||||
data: { relativePath: slug as FilePath, ...data },
|
||||
})
|
||||
// publishes notes with `publish: true`, and files a published page links to
|
||||
const explicitPublish = {
|
||||
name: "ExplicitPublish",
|
||||
shouldPublish: (_ctx: BuildCtx, [, vfile]: ReturnType<typeof note>) =>
|
||||
vfile.data.frontmatter?.publish === true || (vfile.data.referencedBy?.length ?? 0) > 0,
|
||||
}
|
||||
const makeCtx = (plugins: Record<string, unknown[]> = {}) =>
|
||||
({
|
||||
cfg: { configuration: {}, plugins: { filters: [explicitPublish], ...plugins } },
|
||||
argv: {},
|
||||
virtualPages: [],
|
||||
}) as unknown as BuildCtx
|
||||
|
||||
test("referencesByTarget lists the pages linking to each target", () => {
|
||||
const refs = referencesByTarget([
|
||||
note("a", ["board.canvas", "b"]),
|
||||
note("b", ["board.canvas", "board.canvas"]),
|
||||
])
|
||||
assert.deepStrictEqual(refs.get("board.canvas" as SimpleSlug), ["a", "b"])
|
||||
assert.deepStrictEqual(refs.get("b" as SimpleSlug), ["a"])
|
||||
})
|
||||
|
||||
test("file-backed pages go through the filters, with referencedBy; listings do not", async () => {
|
||||
const ctx = makeCtx()
|
||||
const entries = await generateVirtualPages(
|
||||
[
|
||||
makePageType({
|
||||
name: "canvas",
|
||||
fileExtensions: [".canvas"],
|
||||
generate: () => [page("linked.canvas"), page("secret.canvas")],
|
||||
}),
|
||||
makePageType({
|
||||
name: "excalidraw",
|
||||
fileExtensions: [".excalidraw.md"],
|
||||
generate: () => [
|
||||
page("drawing.excalidraw", { frontmatter: { title: "drawing", publish: true } }),
|
||||
],
|
||||
}),
|
||||
makePageType({ name: "tags", generate: () => [page("tags/a")] }),
|
||||
],
|
||||
[note("index", ["linked.canvas"], { publish: true })],
|
||||
ctx,
|
||||
{ head: StubHead },
|
||||
{},
|
||||
)
|
||||
assert.deepStrictEqual(
|
||||
entries.map((e) => e.vpSlug),
|
||||
["linked.canvas", "drawing.excalidraw", "tags/a"],
|
||||
)
|
||||
assert.deepStrictEqual(entries[0].vfile.data.referencedBy, ["index"])
|
||||
assert.deepStrictEqual(entries[1].vfile.data.referencedBy, [])
|
||||
assert.strictEqual(entries[2].vfile.data.referencedBy, undefined)
|
||||
assert.deepStrictEqual(
|
||||
ctx.virtualPages.map(([, vfile]) => vfile.data.slug),
|
||||
["linked.canvas", "drawing.excalidraw", "tags/a"],
|
||||
)
|
||||
})
|
||||
|
||||
const rendered = (ctx: BuildCtx) => {
|
||||
const [tree, vfile] = defaultProcessedContent({
|
||||
slug: "board.canvas" as FullSlug,
|
||||
relativePath: "board.canvas" as FilePath,
|
||||
frontmatter: { title: "board", password: "pw" },
|
||||
htmlAst: {
|
||||
type: "root",
|
||||
children: [{ type: "element", tagName: "p", properties: {}, children: [] }],
|
||||
} as HtmlRoot,
|
||||
})
|
||||
const layout = resolveLayout(makePageType(), { head: StubHead }, {})
|
||||
ctx.virtualPages.push([tree, vfile])
|
||||
return {
|
||||
ve: { tree, vfile, layout, vpSlug: "board.canvas" as FullSlug, fileBacked: true },
|
||||
ctx,
|
||||
}
|
||||
}
|
||||
|
||||
test("virtualPageHtmlPlugins process the rendered body, which the page then shows", () => {
|
||||
const seen: unknown[] = []
|
||||
const { ve, ctx } = rendered(
|
||||
makeCtx({
|
||||
transformers: [
|
||||
{
|
||||
name: "Encrypt",
|
||||
virtualPageHtmlPlugins: (_ctx: BuildCtx, content: unknown[]) => {
|
||||
seen.push(content)
|
||||
return [
|
||||
() => (tree: HtmlRoot, file: { data: Record<string, unknown> }) => {
|
||||
tree.children = [{ type: "text", value: "encrypted" }]
|
||||
file.data.encrypted = true
|
||||
},
|
||||
]
|
||||
},
|
||||
},
|
||||
],
|
||||
}),
|
||||
)
|
||||
const Body = ve.layout.pageBody
|
||||
assert.strictEqual(processVirtualPageHtml(ve, ctx, []), true)
|
||||
assert.deepStrictEqual(seen, [[]])
|
||||
assert.deepStrictEqual(ve.tree.children, [{ type: "text", value: "encrypted" }])
|
||||
assert.strictEqual(ve.vfile.data.htmlAst, ve.tree)
|
||||
assert.strictEqual((ve.vfile.data as Record<string, unknown>).encrypted, true)
|
||||
assert.strictEqual(ctx.virtualPages[0][0], ve.tree)
|
||||
assert.notStrictEqual(ve.layout.pageBody, Body)
|
||||
})
|
||||
|
||||
test("a page whose processing leaves the tree alone keeps its body", () => {
|
||||
const { ve, ctx } = rendered(
|
||||
makeCtx({ transformers: [{ name: "Noop", virtualPageHtmlPlugins: () => [() => () => {}] }] }),
|
||||
)
|
||||
const Body = ve.layout.pageBody
|
||||
assert.strictEqual(processVirtualPageHtml(ve, ctx, []), true)
|
||||
assert.strictEqual(ve.layout.pageBody, Body)
|
||||
assert.strictEqual(ve.tree.children.length, 0)
|
||||
})
|
||||
|
||||
test("a page whose body failed to render is not published unprocessed", () => {
|
||||
const { ve, ctx } = rendered(
|
||||
makeCtx({ transformers: [{ name: "Encrypt", virtualPageHtmlPlugins: () => [] }] }),
|
||||
)
|
||||
ve.vfile.data.htmlAst = undefined
|
||||
assert.strictEqual(processVirtualPageHtml(ve, ctx, []), false)
|
||||
// without such plugins nothing changes
|
||||
assert.strictEqual(processVirtualPageHtml(ve, makeCtx(), []), true)
|
||||
})
|
||||
})
|
||||
@@ -2,7 +2,15 @@ import { QuartzEmitterPlugin, QuartzPageTypePluginInstance, TreeTransform } from
|
||||
import { QuartzComponent, QuartzComponentProps } from "../../components/types"
|
||||
import { pageResources, renderPage } from "../../components/renderPage"
|
||||
import { FullPageLayout } from "../../cfg"
|
||||
import { FilePath, FullSlug, joinSegments, pathToRoot, slugifyFilePath } from "../../util/path"
|
||||
import {
|
||||
FilePath,
|
||||
FullSlug,
|
||||
SimpleSlug,
|
||||
joinSegments,
|
||||
pathToRoot,
|
||||
simplifySlug,
|
||||
slugifyFilePath,
|
||||
} from "../../util/path"
|
||||
import { ProcessedContent, defaultProcessedContent } from "../vfile"
|
||||
import { write } from "../emitters/helpers"
|
||||
import { BuildCtx, trieFromAllFiles } from "../../util/ctx"
|
||||
@@ -10,6 +18,12 @@ import { StaticResources } from "../../util/resources"
|
||||
import { render } from "preact-render-to-string"
|
||||
import { fromHtml } from "hast-util-from-html"
|
||||
import { Root as HtmlRoot } from "hast"
|
||||
import { toHtml } from "hast-util-to-html"
|
||||
import { unified } from "unified"
|
||||
import { htmlToJsx } from "../../util/jsx"
|
||||
import { trace } from "../../util/trace"
|
||||
import { attributeError, originOf } from "../../util/pluginErrors"
|
||||
import { rejectingFilter } from "../../processors/filter"
|
||||
import fs from "fs"
|
||||
import path from "path"
|
||||
|
||||
@@ -143,6 +157,11 @@ export type VirtualEntry = {
|
||||
vfile: ProcessedContent[1]
|
||||
layout: FullPageLayout
|
||||
vpSlug: FullSlug
|
||||
/**
|
||||
* Generated by a page type that renders source files (it declares `fileExtensions`, e.g. a
|
||||
* `.base` or `.canvas` file): the page stands for a file and belongs in the folder hierarchy.
|
||||
*/
|
||||
fileBacked: boolean
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -150,6 +169,10 @@ export type VirtualEntry = {
|
||||
* content. `generate` may be async (Quartz 5.1+), e.g. to run the transformer chain or
|
||||
* esbuild; page types run one after another in priority order, as before. Virtual pages
|
||||
* (except the 404 page) are added to `ctx.virtualPages`.
|
||||
*
|
||||
* Pages of page types that render files (`fileExtensions`: `.base`, `.canvas`, …) go through the
|
||||
* site's filters first, with `file.data.referencedBy` set; a page a filter rejects is dropped, so
|
||||
* it is neither emitted nor listed (content index, folder pages, explorer, search) nor embeddable.
|
||||
*/
|
||||
export async function generateVirtualPages(
|
||||
pageTypes: QuartzPageTypePluginInstance[],
|
||||
@@ -160,10 +183,12 @@ export async function generateVirtualPages(
|
||||
): Promise<VirtualEntry[]> {
|
||||
const cfg = ctx.cfg.configuration
|
||||
const virtualEntries: VirtualEntry[] = []
|
||||
let references: Map<SimpleSlug, FullSlug[]> | undefined
|
||||
for (const pt of pageTypes) {
|
||||
if (!pt.generate) continue
|
||||
const virtualPages = await pt.generate({ content, cfg, ctx })
|
||||
const layout = resolveLayout(pt, defaults, byPageType)
|
||||
const fileBacked = (pt.fileExtensions?.length ?? 0) > 0
|
||||
for (const vp of virtualPages) {
|
||||
const vpSlug = vp.slug as FullSlug
|
||||
const vpRelativePath = (vpSlug + ".md") as FilePath
|
||||
@@ -173,27 +198,130 @@ export async function generateVirtualPages(
|
||||
frontmatter: { title: vp.title, tags: [] },
|
||||
...vp.data,
|
||||
})
|
||||
if (fileBacked) {
|
||||
// A page that stands for a file is published on the same terms as a note: the site's
|
||||
// filters decide, seeing the frontmatter the page type gives it (an `.excalidraw.md`
|
||||
// drawing's own) and which published pages link to it (bases-page#11).
|
||||
references ??= referencesByTarget(content)
|
||||
vfile.data.referencedBy = references.get(simplifySlug(vpSlug)) ?? []
|
||||
if (rejectingFilter(ctx, [tree, vfile]) !== undefined) continue
|
||||
}
|
||||
if (vpSlug !== "404") {
|
||||
ctx.virtualPages.push([tree, vfile])
|
||||
}
|
||||
virtualEntries.push({ tree, vfile, layout, vpSlug })
|
||||
virtualEntries.push({ tree, vfile, layout, vpSlug, fileBacked })
|
||||
}
|
||||
}
|
||||
return virtualEntries
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal Exported for testing only.
|
||||
*
|
||||
* For each link target, the published pages that link to or embed it (`file.data.links`), in
|
||||
* content order.
|
||||
*/
|
||||
export function referencesByTarget(content: ProcessedContent[]): Map<SimpleSlug, FullSlug[]> {
|
||||
const references = new Map<SimpleSlug, FullSlug[]>()
|
||||
for (const [, file] of content) {
|
||||
const slug = file.data.slug
|
||||
if (!slug) continue
|
||||
for (const target of new Set(file.data.links ?? [])) {
|
||||
const from = references.get(target)
|
||||
if (from) from.push(slug)
|
||||
else references.set(target, [slug])
|
||||
}
|
||||
}
|
||||
return references
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal Exported for testing only.
|
||||
*
|
||||
* The folder hierarchy (`ctx.trie`, used by folder pages and breadcrumbs): the source files plus
|
||||
* the virtual pages that stand for files (`.base`, `.canvas`, …), so a folder holding only such
|
||||
* files still has a node with them as children (jackyzha0/quartz#2576). Tag and folder pages
|
||||
* are left out — they are listings, not files.
|
||||
*/
|
||||
export function folderTrie(
|
||||
allFiles: ProcessedContent[1]["data"][],
|
||||
virtualEntries: VirtualEntry[],
|
||||
) {
|
||||
const fileBacked = virtualEntries
|
||||
.filter((ve) => ve.fileBacked)
|
||||
// the trie takes folder display names from file paths; a virtual page has only relativePath
|
||||
.map((ve) => ({
|
||||
...ve.vfile.data,
|
||||
filePath: ve.vfile.data.filePath ?? ve.vfile.data.relativePath,
|
||||
}))
|
||||
return trieFromAllFiles([...allFiles, ...fileBacked])
|
||||
}
|
||||
|
||||
/** Renders a page's (already rendered and processed) tree as its body. */
|
||||
const RenderedBody: QuartzComponent = ({ fileData, tree }: QuartzComponentProps) =>
|
||||
htmlToJsx((fileData.filePath ?? fileData.relativePath ?? fileData.slug) as FilePath, tree)
|
||||
|
||||
/**
|
||||
* @internal Exported for testing only.
|
||||
*
|
||||
* Run the transformers' `virtualPageHtmlPlugins` on the rendered body (`file.data.htmlAst`) of a
|
||||
* page that stands for a file — e.g. encrypted-pages encrypting a canvas. When they change the
|
||||
* tree, the page shows the changed tree instead of rendering its body again. A page whose body
|
||||
* failed to render, or that a plugin throws on, is left unpublished: emitting it unprocessed could
|
||||
* publish what the plugin protects.
|
||||
*/
|
||||
export function processVirtualPageHtml(
|
||||
ve: VirtualEntry,
|
||||
ctx: BuildCtx,
|
||||
content: ProcessedContent[],
|
||||
): boolean {
|
||||
if (!ve.fileBacked) return true
|
||||
const transformers = (ctx.cfg.plugins?.transformers ?? []).filter((t) => t.virtualPageHtmlPlugins)
|
||||
if (transformers.length === 0) return true
|
||||
// its body failed to render: there is nothing to process, and it can't be emitted processed
|
||||
const htmlAst = ve.vfile.data.htmlAst
|
||||
if (!htmlAst) return false
|
||||
|
||||
const before = toHtml(htmlAst, { allowDangerousHtml: true })
|
||||
for (const transformer of transformers) {
|
||||
try {
|
||||
const processor = unified().use(transformer.virtualPageHtmlPlugins!(ctx, content))
|
||||
ve.vfile.data.htmlAst = processor.runSync(ve.vfile.data.htmlAst!, ve.vfile) as HtmlRoot
|
||||
} catch (err) {
|
||||
const file = ve.vfile.data.relativePath ?? ve.vpSlug
|
||||
trace(
|
||||
`Failed to process the HTML of \`${file}\``,
|
||||
attributeError(err, { origin: originOf(transformer), stage: "html", file }) as Error,
|
||||
)
|
||||
return false
|
||||
}
|
||||
}
|
||||
const processed = ve.vfile.data.htmlAst!
|
||||
if (toHtml(processed, { allowDangerousHtml: true }) !== before) {
|
||||
ve.tree = processed
|
||||
ve.layout = { ...ve.layout, pageBody: RenderedBody }
|
||||
// emitters that run later (content index, assets, …) read the page from ctx.virtualPages
|
||||
const item = ctx.virtualPages.find(([, vfile]) => vfile === ve.vfile)
|
||||
if (item) item[0] = processed
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
/**
|
||||
* Render each virtual page's Body component to HTML and parse it to a hast tree,
|
||||
* populating both the ProcessedContent tree and vfile.data.htmlAst so that
|
||||
* transclusion (e.g. ![[file.canvas]]) can inline the virtual page's content.
|
||||
* populating vfile.data.htmlAst so that transclusion (e.g. ![[file.canvas]]) can inline the
|
||||
* virtual page's content, then run `virtualPageHtmlPlugins` on it (pages that stand for files).
|
||||
* Returns the entries to emit: those whose processing failed are removed from `ctx.virtualPages`.
|
||||
*/
|
||||
function populateVirtualPageHtmlAst(
|
||||
virtualEntries: VirtualEntry[],
|
||||
ctx: BuildCtx,
|
||||
allFiles: ProcessedContent[1]["data"][],
|
||||
resources: StaticResources,
|
||||
) {
|
||||
content: ProcessedContent[],
|
||||
): VirtualEntry[] {
|
||||
const cfg = ctx.cfg.configuration
|
||||
const failed = new Set<VirtualEntry>()
|
||||
for (const ve of virtualEntries) {
|
||||
const BodyComponent = ve.layout.pageBody
|
||||
const externalResources = pageResources(pathToRoot(ve.vpSlug), resources, ctx)
|
||||
@@ -214,7 +342,16 @@ function populateVirtualPageHtmlAst(
|
||||
// Body rendering failed — leave htmlAst empty so transclusion falls
|
||||
// back to the default title-only display.
|
||||
}
|
||||
// processed right after rendering, so later bodies that embed this page see the result
|
||||
if (!processVirtualPageHtml(ve, ctx, content)) {
|
||||
failed.add(ve)
|
||||
ve.vfile.data.htmlAst = undefined
|
||||
}
|
||||
}
|
||||
if (failed.size === 0) return virtualEntries
|
||||
const failedData = new Set([...failed].map((ve) => ve.vfile.data))
|
||||
ctx.virtualPages = ctx.virtualPages.filter(([, vfile]) => !failedData.has(vfile.data))
|
||||
return virtualEntries.filter((ve) => !failed.has(ve))
|
||||
}
|
||||
|
||||
export const PageTypeDispatcher: QuartzEmitterPlugin<Partial<DispatcherOptions>> = (userOpts) => {
|
||||
@@ -250,6 +387,10 @@ export const PageTypeDispatcher: QuartzEmitterPlugin<Partial<DispatcherOptions>>
|
||||
byPageType,
|
||||
)
|
||||
|
||||
if (virtualEntries.some((ve) => ve.fileBacked)) {
|
||||
ctx.trie = folderTrie(allFiles, virtualEntries)
|
||||
}
|
||||
|
||||
// Merge virtual page data into allFiles before populating htmlAst so that
|
||||
// Body components rendered during populateVirtualPageHtmlAst can resolve
|
||||
// cross-virtual-page embeds (e.g. a .base file embedded in a .canvas file).
|
||||
@@ -258,7 +399,13 @@ export const PageTypeDispatcher: QuartzEmitterPlugin<Partial<DispatcherOptions>>
|
||||
const allFilesWithVirtual = [...allFiles, ...virtualEntries.map((ve) => ve.vfile.data)]
|
||||
|
||||
// Render Body components to populate htmlAst for transclusion
|
||||
populateVirtualPageHtmlAst(virtualEntries, ctx, allFilesWithVirtual, resources)
|
||||
const entriesToEmit = populateVirtualPageHtmlAst(
|
||||
virtualEntries,
|
||||
ctx,
|
||||
allFilesWithVirtual,
|
||||
resources,
|
||||
content,
|
||||
)
|
||||
|
||||
// Phase 2: Emit regular pages (with virtual page data available for transclusion)
|
||||
for (const [tree, file] of content) {
|
||||
@@ -283,7 +430,7 @@ export const PageTypeDispatcher: QuartzEmitterPlugin<Partial<DispatcherOptions>>
|
||||
}
|
||||
|
||||
// Phase 3: Emit virtual pages
|
||||
for (const ve of virtualEntries) {
|
||||
for (const ve of entriesToEmit) {
|
||||
yield emitPage(
|
||||
ctx,
|
||||
ve.vpSlug,
|
||||
@@ -334,10 +481,18 @@ export const PageTypeDispatcher: QuartzEmitterPlugin<Partial<DispatcherOptions>>
|
||||
byPageType,
|
||||
)
|
||||
|
||||
ctx.trie = folderTrie(allFiles, virtualEntries)
|
||||
|
||||
const allFilesWithVirtual = [...allFiles, ...virtualEntries.map((ve) => ve.vfile.data)]
|
||||
|
||||
// Render Body components to populate htmlAst for transclusion
|
||||
populateVirtualPageHtmlAst(virtualEntries, ctx, allFilesWithVirtual, resources)
|
||||
const entriesToEmit = populateVirtualPageHtmlAst(
|
||||
virtualEntries,
|
||||
ctx,
|
||||
allFilesWithVirtual,
|
||||
resources,
|
||||
content,
|
||||
)
|
||||
|
||||
// Phase 2: Emit changed regular pages
|
||||
for (const [tree, file] of content) {
|
||||
@@ -364,7 +519,7 @@ export const PageTypeDispatcher: QuartzEmitterPlugin<Partial<DispatcherOptions>>
|
||||
}
|
||||
|
||||
// Phase 3: Emit virtual pages
|
||||
for (const ve of virtualEntries) {
|
||||
for (const ve of entriesToEmit) {
|
||||
yield emitPage(
|
||||
ctx,
|
||||
ve.vpSlug,
|
||||
@@ -379,3 +534,14 @@ export const PageTypeDispatcher: QuartzEmitterPlugin<Partial<DispatcherOptions>>
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
declare module "vfile" {
|
||||
interface DataMap {
|
||||
/**
|
||||
* On a page that stands for a file (`.base`, `.canvas`, …): the published pages that link to
|
||||
* or embed it. Set before the site's filters see the page, e.g. so explicit-publish can publish
|
||||
* a file that has no frontmatter when a published note links to it.
|
||||
*/
|
||||
referencedBy: FullSlug[]
|
||||
}
|
||||
}
|
||||
@@ -61,6 +61,14 @@ export type QuartzTransformerPluginInstance = PluginHooks & {
|
||||
textTransform?: (ctx: BuildCtx, src: string) => string
|
||||
markdownPlugins?: (ctx: BuildCtx) => PluggableList
|
||||
htmlPlugins?: (ctx: BuildCtx) => PluggableList
|
||||
/**
|
||||
* rehype plugins for the pages that page types render from files (`.base`, `.canvas`, …).
|
||||
* Those pages are rendered at emit time and never pass through `htmlPlugins`; these plugins
|
||||
* run on each one's rendered body (with the page's vfile, so `file.data.frontmatter` and
|
||||
* `file.data.referencedBy` are available) after the site's filters published it, and the page
|
||||
* shows the resulting tree. `content` is the published content. Quartz 5.1+.
|
||||
*/
|
||||
virtualPageHtmlPlugins?: (ctx: BuildCtx, content: ProcessedContent[]) => PluggableList
|
||||
externalResources?: ExternalResourcesFn
|
||||
}
|
||||
|
||||
|
||||
+36
-12
@@ -1,27 +1,51 @@
|
||||
import { BuildCtx } from "../util/ctx"
|
||||
import { PerfTimer } from "../util/perf"
|
||||
import { ProcessedContent } from "../plugins/vfile"
|
||||
import { QuartzFilterPluginInstance } from "../plugins/types"
|
||||
import { attributeError, originOf } from "../util/pluginErrors"
|
||||
import { recordFiltered } from "../util/diagnostics"
|
||||
import { trace } from "../util/trace"
|
||||
|
||||
/** Whether `plugin` publishes `item`; a filter that throws reports the error and rejects it. */
|
||||
function publishes(
|
||||
ctx: BuildCtx,
|
||||
plugin: QuartzFilterPluginInstance,
|
||||
item: ProcessedContent,
|
||||
): boolean {
|
||||
try {
|
||||
return plugin.shouldPublish(ctx, item)
|
||||
} catch (err) {
|
||||
const file = item[1].data.relativePath ?? item[1].data.slug
|
||||
trace(
|
||||
`Failed to filter \`${file}\``,
|
||||
attributeError(err, { origin: originOf(plugin), stage: "filter", file }) as Error,
|
||||
)
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the site's filters on one page (e.g. a virtual page that stands for a `.base` or `.canvas`
|
||||
* file). Returns the name of the first filter that rejects it, or `undefined` when it is
|
||||
* published. A rejection is recorded like one from `filterContent`.
|
||||
*/
|
||||
export function rejectingFilter(ctx: BuildCtx, item: ProcessedContent): string | undefined {
|
||||
for (const plugin of ctx.cfg.plugins?.filters ?? []) {
|
||||
if (publishes(ctx, plugin, item)) continue
|
||||
const slug = item[1].data.slug
|
||||
if (slug) recordFiltered(slug, plugin.name)
|
||||
if (ctx.argv?.verbose) console.log(`[filter:${plugin.name}] ${slug}`)
|
||||
return plugin.name
|
||||
}
|
||||
return undefined
|
||||
}
|
||||
|
||||
export function filterContent(ctx: BuildCtx, content: ProcessedContent[]): ProcessedContent[] {
|
||||
const { cfg, argv } = ctx
|
||||
const perf = new PerfTimer()
|
||||
const initialLength = content.length
|
||||
for (const plugin of cfg.plugins.filters) {
|
||||
const updatedContent = content.filter((item) => {
|
||||
try {
|
||||
return plugin.shouldPublish(ctx, item)
|
||||
} catch (err) {
|
||||
const file = item[1].data.relativePath ?? item[1].data.slug
|
||||
trace(
|
||||
`Failed to filter \`${file}\``,
|
||||
attributeError(err, { origin: originOf(plugin), stage: "filter", file }) as Error,
|
||||
)
|
||||
return false
|
||||
}
|
||||
})
|
||||
const updatedContent = content.filter((item) => publishes(ctx, plugin, item))
|
||||
for (const item of content) {
|
||||
if (!updatedContent.includes(item) && item[1].data.slug) {
|
||||
recordFiltered(item[1].data.slug, plugin.name)
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
import test, { describe } from "node:test"
|
||||
import assert from "node:assert"
|
||||
import fs from "node:fs"
|
||||
import os from "node:os"
|
||||
import path from "node:path"
|
||||
import { readContentFile } from "./parse"
|
||||
import { isContentError } from "../util/pluginErrors"
|
||||
import type { FilePath } from "../util/path"
|
||||
|
||||
describe("readContentFile", () => {
|
||||
test("reads a file", async () => {
|
||||
const dir = await fs.promises.mkdtemp(path.join(os.tmpdir(), "quartz-parse-"))
|
||||
try {
|
||||
const fp = path.join(dir, "note.md")
|
||||
await fs.promises.writeFile(fp, "# hi")
|
||||
assert.strictEqual((await readContentFile(fp as FilePath)).toString(), "# hi")
|
||||
} finally {
|
||||
await fs.promises.rm(dir, { recursive: true })
|
||||
}
|
||||
})
|
||||
|
||||
test("a file that can't be read is a content error", async () => {
|
||||
const dir = await fs.promises.mkdtemp(path.join(os.tmpdir(), "quartz-parse-"))
|
||||
try {
|
||||
// a directory named like a note, and a file that is gone
|
||||
await fs.promises.mkdir(path.join(dir, "folder.md"))
|
||||
for (const [name, reason] of [
|
||||
["folder.md", "it is a directory (EISDIR)"],
|
||||
["missing.md", "it no longer exists (ENOENT)"],
|
||||
]) {
|
||||
await assert.rejects(
|
||||
readContentFile(path.join(dir, name) as FilePath),
|
||||
(err: Error) =>
|
||||
isContentError(err) && err.message === `Cannot read \`${name}\`: ${reason}`,
|
||||
)
|
||||
}
|
||||
} finally {
|
||||
await fs.promises.rm(dir, { recursive: true })
|
||||
}
|
||||
})
|
||||
})
|
||||
@@ -15,7 +15,12 @@ import { QuartzLogger } from "../util/log"
|
||||
import { trace } from "../util/trace"
|
||||
import { BuildCtx, WorkerSerializableBuildCtx } from "../util/ctx"
|
||||
import { styleText } from "util"
|
||||
import { attributeError, attributePluggables, originOf } from "../util/pluginErrors"
|
||||
import {
|
||||
attributeError,
|
||||
attributePluggables,
|
||||
originOf,
|
||||
unreadableFileError,
|
||||
} from "../util/pluginErrors"
|
||||
|
||||
export type QuartzMdProcessor = Processor<MDRoot, MDRoot, MDRoot>
|
||||
export type QuartzHtmlProcessor = Processor<undefined, MDRoot, HTMLRoot>
|
||||
@@ -90,6 +95,19 @@ async function transpileWorkerScript() {
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Read a content file. A file that can't be read (no permission, removed during the build, …) is a
|
||||
* problem with the content, not a Quartz bug.
|
||||
* @internal Exported for testing.
|
||||
*/
|
||||
export async function readContentFile(fp: FilePath) {
|
||||
try {
|
||||
return await read(fp)
|
||||
} catch (err) {
|
||||
throw unreadableFileError(err, path.basename(fp)) ?? err
|
||||
}
|
||||
}
|
||||
|
||||
export function createFileParser(ctx: BuildCtx, fps: FilePath[]) {
|
||||
const { argv, cfg } = ctx
|
||||
return async (processor: QuartzMdProcessor) => {
|
||||
@@ -97,7 +115,7 @@ export function createFileParser(ctx: BuildCtx, fps: FilePath[]) {
|
||||
for (const fp of fps) {
|
||||
try {
|
||||
const perf = new PerfTimer()
|
||||
const file = await read(fp)
|
||||
const file = await readContentFile(fp)
|
||||
|
||||
// strip leading and trailing whitespace
|
||||
file.value = file.value.toString().trim()
|
||||
|
||||
+6
-1
@@ -42,7 +42,12 @@ export interface BuildCtx {
|
||||
permalinks?: Record<string, FullSlug>
|
||||
trie?: FileTrieNode<BuildTimeTrieData>
|
||||
incremental: boolean
|
||||
/** Virtual pages generated by page type plugins (e.g. tag pages, folder pages, bases pages) */
|
||||
/**
|
||||
* Virtual pages generated by page type plugins (e.g. tag pages, folder pages, bases pages).
|
||||
* Page types generate in priority order, so while a page type's `generate` runs this holds the
|
||||
* virtual pages of the page types before it (folder pages use it to find folders that hold only
|
||||
* `.base` / `.canvas` pages).
|
||||
*/
|
||||
virtualPages: ProcessedContent[]
|
||||
/** Content-hashed asset filenames, populated by ComponentResources emitter */
|
||||
hashedResourceNames?: HashedResourceNames
|
||||
|
||||
@@ -20,6 +20,7 @@ export {
|
||||
splitAnchor,
|
||||
slugTag,
|
||||
transformInternalLink,
|
||||
linkPathDecodes,
|
||||
transformLink,
|
||||
normalizeHastElement,
|
||||
} from "@quartz-community/utils"
|
||||
|
||||
@@ -9,6 +9,7 @@ import {
|
||||
PluginError,
|
||||
ContentError,
|
||||
isContentError,
|
||||
unreadableFileError,
|
||||
} from "./pluginErrors"
|
||||
import {
|
||||
recordDiagnostic,
|
||||
@@ -238,3 +239,19 @@ describe("plugin load failures", () => {
|
||||
assert.ok(text.indexOf("failed to load") < text.indexOf("some warning"))
|
||||
})
|
||||
})
|
||||
|
||||
describe("unreadableFileError", () => {
|
||||
test("turns a file-system error into a content error naming the file", () => {
|
||||
const fsError = Object.assign(new Error("EACCES: permission denied, open 'x'"), {
|
||||
code: "EACCES",
|
||||
})
|
||||
const err = unreadableFileError(fsError, "notes/x.md")
|
||||
assert.ok(err && isContentError(err))
|
||||
assert.strictEqual(err.message, "Cannot read `notes/x.md`: permission denied (EACCES)")
|
||||
assert.strictEqual(err.cause, fsError)
|
||||
})
|
||||
|
||||
test("leaves other errors alone", () => {
|
||||
assert.strictEqual(unreadableFileError(new TypeError("boom"), "x.md"), undefined)
|
||||
})
|
||||
})
|
||||
@@ -50,6 +50,24 @@ export class ContentError extends Error {
|
||||
}
|
||||
}
|
||||
|
||||
const fileErrorReasons: Record<string, string> = {
|
||||
EACCES: "permission denied",
|
||||
EPERM: "permission denied",
|
||||
EISDIR: "it is a directory",
|
||||
ENOENT: "it no longer exists",
|
||||
}
|
||||
|
||||
/**
|
||||
* A {@link ContentError} for a content file that can't be read (`err` from `fs`), or `undefined`
|
||||
* when `err` is not a file-system error.
|
||||
*/
|
||||
export function unreadableFileError(err: unknown, file: string): ContentError | undefined {
|
||||
const code = (err as NodeJS.ErrnoException | null)?.code
|
||||
if (typeof code !== "string") return undefined
|
||||
const reason = fileErrorReasons[code] ?? (err as Error).message
|
||||
return new ContentError(`Cannot read \`${file}\`: ${reason} (${code})`, { cause: err })
|
||||
}
|
||||
|
||||
/** Whether `err` or one of its causes (e.g. inside a {@link PluginError}) is a {@link ContentError}. */
|
||||
export function isContentError(err: unknown): boolean {
|
||||
let e = err
|
||||
|
||||
+13
-1
@@ -1,5 +1,6 @@
|
||||
import { styleText } from "util"
|
||||
import process from "process"
|
||||
import esbuild from "esbuild"
|
||||
import { isMainThread } from "workerpool"
|
||||
import { isContentError, pluginErrorInfo, PluginErrorInfo } from "./pluginErrors"
|
||||
import { knownProblemsFor } from "./diagnostics"
|
||||
@@ -130,6 +131,17 @@ export function trace(msg: string, err: Error) {
|
||||
} else {
|
||||
// print and exit
|
||||
console.error(traceMsg)
|
||||
process.exit(1)
|
||||
exitBuild(1)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Exit the build process. esbuild's service is a child process that shares our stderr; exiting
|
||||
* while it has requests in flight (bundling component scripts, the CLI's build context) left it
|
||||
* running without its parent, and it printed "fatal error: all goroutines are asleep - deadlock!"
|
||||
* and a goroutine dump after Quartz's error. Stop it first.
|
||||
*/
|
||||
export function exitBuild(code: number): never {
|
||||
void esbuild.stop()
|
||||
process.exit(code)
|
||||
}
|
||||
Reference in new issue
Block a user