@quartz-community/explicit-publish 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/README.md +12 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +7 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 0053681: Files without frontmatter — `.base`, `.canvas` and `.excalidraw` pages — are published when a published page links to them, and not otherwise (quartz-community/bases-page#11). Before, every such file was published regardless of this filter. Needs Quartz 5.1, which runs the filters on these pages; with older Quartz nothing changes.
|
|
8
|
+
|
|
9
|
+
## 1.0.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 952de74: Releases are published from GitHub Actions with npm trusted publishing, so each version on npm now carries provenance linking it to the commit and workflow that built it. No changes to the package itself.
|
|
14
|
+
|
|
3
15
|
## 1.0.0
|
|
4
16
|
|
|
5
17
|
### Major Changes
|
package/README.md
CHANGED
|
@@ -16,6 +16,18 @@ plugins:
|
|
|
16
16
|
enabled: true
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
+
## Files without frontmatter
|
|
20
|
+
|
|
21
|
+
`.base`, `.canvas` and `.excalidraw` files have no frontmatter to put `publish: true` in. They are
|
|
22
|
+
published along with the published pages that link to them (`[[Board.canvas]]`, or an embed that
|
|
23
|
+
needs the file's page, such as `![[Board.canvas]]`), and not otherwise — like Obsidian Publish
|
|
24
|
+
adding the files a published note links to. A file that only unpublished notes reference, or that
|
|
25
|
+
nothing references, is not published. A base embedded in a published note (`![[Views.base]]` or a
|
|
26
|
+
` ```base ` block) renders inside that note without getting a page of its own.
|
|
27
|
+
|
|
28
|
+
A drawing stored as Markdown (`.excalidraw.md`) has frontmatter, and follows its own `publish:`
|
|
29
|
+
like a note. This needs Quartz 5.1 or later, which runs the filters on these pages.
|
|
30
|
+
|
|
19
31
|
## Configuration
|
|
20
32
|
|
|
21
33
|
This plugin has no configuration options.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import { QuartzFilterPlugin } from '@quartz-community/types';
|
|
2
2
|
export { QuartzFilterPlugin } from '@quartz-community/types';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Publishes pages whose frontmatter has `publish: true`.
|
|
6
|
+
*
|
|
7
|
+
* Files without frontmatter (`.base`, `.canvas`, `.excalidraw` pages, which page types render
|
|
8
|
+
* from the file itself) have no way to opt in. They are published along with the published pages
|
|
9
|
+
* that link to them, like Obsidian Publish adds the files a published note links to: Quartz 5.1+
|
|
10
|
+
* runs the filters on such pages with `file.data.referencedBy` set to those pages. A file only
|
|
11
|
+
* embedded or linked by unpublished notes, or by nothing, is not published.
|
|
12
|
+
*/
|
|
4
13
|
declare const ExplicitPublish: QuartzFilterPlugin;
|
|
5
14
|
|
|
6
15
|
export { ExplicitPublish };
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,13 @@ var ExplicitPublish = () => ({
|
|
|
3
3
|
name: "ExplicitPublish",
|
|
4
4
|
shouldPublish(_ctx, [_tree, vfile]) {
|
|
5
5
|
const frontmatter = vfile.data?.frontmatter;
|
|
6
|
-
|
|
6
|
+
if (frontmatter?.publish === true || frontmatter?.publish === "true") return true;
|
|
7
|
+
const relativePath = vfile.data?.relativePath;
|
|
8
|
+
if (typeof relativePath === "string" && !relativePath.toLowerCase().endsWith(".md")) {
|
|
9
|
+
const referencedBy = vfile.data.referencedBy;
|
|
10
|
+
return Array.isArray(referencedBy) && referencedBy.length > 0;
|
|
11
|
+
}
|
|
12
|
+
return false;
|
|
7
13
|
}
|
|
8
14
|
});
|
|
9
15
|
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/filter.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"sources":["../src/filter.ts"],"names":[],"mappings":";AAWO,IAAM,kBAAsC,OAAO;AAAA,EACxD,IAAA,EAAM,iBAAA;AAAA,EACN,aAAA,CAAc,IAAA,EAAM,CAAC,KAAA,EAAO,KAAK,CAAA,EAAG;AAClC,IAAA,MAAM,WAAA,GAAc,MAAM,IAAA,EAAM,WAAA;AAChC,IAAA,IAAI,aAAa,OAAA,KAAY,IAAA,IAAQ,WAAA,EAAa,OAAA,KAAY,QAAQ,OAAO,IAAA;AAE7E,IAAA,MAAM,YAAA,GAAe,MAAM,IAAA,EAAM,YAAA;AACjC,IAAA,IAAI,OAAO,iBAAiB,QAAA,IAAY,CAAC,aAAa,WAAA,EAAY,CAAE,QAAA,CAAS,KAAK,CAAA,EAAG;AACnF,MAAA,MAAM,YAAA,GAAgB,MAAM,IAAA,CAAiC,YAAA;AAC7D,MAAA,OAAO,KAAA,CAAM,OAAA,CAAQ,YAAY,CAAA,IAAK,aAAa,MAAA,GAAS,CAAA;AAAA,IAC9D;AACA,IAAA,OAAO,KAAA;AAAA,EACT;AACF,CAAA","file":"index.js","sourcesContent":["import type { QuartzFilterPlugin } from \"@quartz-community/types\";\n\n/**\n * Publishes pages whose frontmatter has `publish: true`.\n *\n * Files without frontmatter (`.base`, `.canvas`, `.excalidraw` pages, which page types render\n * from the file itself) have no way to opt in. They are published along with the published pages\n * that link to them, like Obsidian Publish adds the files a published note links to: Quartz 5.1+\n * runs the filters on such pages with `file.data.referencedBy` set to those pages. A file only\n * embedded or linked by unpublished notes, or by nothing, is not published.\n */\nexport const ExplicitPublish: QuartzFilterPlugin = () => ({\n name: \"ExplicitPublish\",\n shouldPublish(_ctx, [_tree, vfile]) {\n const frontmatter = vfile.data?.frontmatter as Record<string, unknown> | undefined;\n if (frontmatter?.publish === true || frontmatter?.publish === \"true\") return true;\n\n const relativePath = vfile.data?.relativePath;\n if (typeof relativePath === \"string\" && !relativePath.toLowerCase().endsWith(\".md\")) {\n const referencedBy = (vfile.data as Record<string, unknown>).referencedBy;\n return Array.isArray(referencedBy) && referencedBy.length > 0;\n }\n return false;\n },\n});\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quartz-community/explicit-publish",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Filter plugin that only publishes pages with explicit publish flag",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -41,7 +41,8 @@
|
|
|
41
41
|
"typecheck": "tsc --noEmit",
|
|
42
42
|
"check": "npm run typecheck && npm run lint && npm run format && npm run test",
|
|
43
43
|
"prepublishOnly": "npm run build",
|
|
44
|
-
"release": "npm run build && changeset publish"
|
|
44
|
+
"release": "npm run build && changeset publish",
|
|
45
|
+
"version-packages": "changeset version && npm install --package-lock-only --ignore-scripts --no-audit --no-fund"
|
|
45
46
|
},
|
|
46
47
|
"dependencies": {
|
|
47
48
|
"@quartz-community/types": "^1.0.0"
|