Compare commits

...

3 Commits

Author SHA1 Message Date
Anton Bulakh
f68ea4aa1f
Merge 1038d1bac70a8bac3b94763c5bc608b9e7c7f359 into 32ec711767401c93605b7631f03eee47dea1cada 2025-02-07 21:11:00 +01:00
dependabot[bot]
32ec711767
chore(deps-dev): bump @types/node in the production-dependencies group (#1751)
Some checks failed
Build and Test / build-and-test (macos-latest) (push) Has been cancelled
Build and Test / build-and-test (ubuntu-latest) (push) Has been cancelled
Build and Test / build-and-test (windows-latest) (push) Has been cancelled
Build and Test / publish-tag (push) Has been cancelled
Docker build & push image / build (push) Has been cancelled
Bumps the production-dependencies group with 1 update: [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node).


Updates `@types/node` from 22.12.0 to 22.13.0
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: production-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-05 05:07:14 -05:00
Anton Bulakh
1038d1bac7
feat(tags): Allow separating page tags from frontmatter tags
I feel like tags in note content are just links to the tag page, and
shouldn't mark the page with that tag.

Also the way it was done - adding content tags to frontmatter -
interferes with my WIP page properties component, I want to only show
"explicitly put in the frontmatter" tags.

Added an option to have those "outgoing" tags that don't tag the page,
yet get a tag page generated (so that the popover is not 404 if there
are no pages with this tag).
2025-01-18 06:20:06 +02:00
5 changed files with 21 additions and 12 deletions

View File

@ -16,7 +16,7 @@ This plugin accepts the following configuration options:
- `wikilinks`:If `true` (default), turns [[wikilinks]] into regular links. - `wikilinks`:If `true` (default), turns [[wikilinks]] into regular links.
- `callouts`: If `true` (default), adds support for [[callouts|callout]] blocks for emphasizing content. - `callouts`: If `true` (default), adds support for [[callouts|callout]] blocks for emphasizing content.
- `mermaid`: If `true` (default), enables [[Mermaid diagrams|Mermaid diagram]] rendering within Markdown files. - `mermaid`: If `true` (default), enables [[Mermaid diagrams|Mermaid diagram]] rendering within Markdown files.
- `parseTags`: If `true` (default), parses and links tags within the content. - `parseTags`: If `true` (default), parses and links tags within the content. This marks the page as tagged with those tags, you can set `parseTags` to `"link-only"` to only turn content tags into links.
- `parseArrows`: If `true` (default), transforms arrow symbols into their HTML character equivalents. - `parseArrows`: If `true` (default), transforms arrow symbols into their HTML character equivalents.
- `parseBlockReferences`: If `true` (default), handles block references, linking to specific content blocks. - `parseBlockReferences`: If `true` (default), handles block references, linking to specific content blocks.
- `enableInHtmlEmbed`: If `true`, allows embedding of content directly within HTML. Defaults to `false`. - `enableInHtmlEmbed`: If `true`, allows embedding of content directly within HTML. Defaults to `false`.

8
package-lock.json generated
View File

@ -79,7 +79,7 @@
"@types/d3": "^7.4.3", "@types/d3": "^7.4.3",
"@types/hast": "^3.0.4", "@types/hast": "^3.0.4",
"@types/js-yaml": "^4.0.9", "@types/js-yaml": "^4.0.9",
"@types/node": "^22.12.0", "@types/node": "^22.13.0",
"@types/pretty-time": "^1.1.5", "@types/pretty-time": "^1.1.5",
"@types/source-map-support": "^0.5.10", "@types/source-map-support": "^0.5.10",
"@types/ws": "^8.5.14", "@types/ws": "^8.5.14",
@ -1914,9 +1914,9 @@
} }
}, },
"node_modules/@types/node": { "node_modules/@types/node": {
"version": "22.12.0", "version": "22.13.0",
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.12.0.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-22.13.0.tgz",
"integrity": "sha512-Fll2FZ1riMjNmlmJOdAyY5pUbkftXslB5DgEzlIuNaiWhXd00FhWxVC/r4yV/4wBb9JfImTu+jiSvXTkJ7F/gA==", "integrity": "sha512-ClIbNe36lawluuvq3+YYhnIN2CELi+6q8NpnM7PYp4hBn/TatfboPgVSm2rwKRfnV2M+Ty9GWDFI64KEe+kysA==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {

View File

@ -102,7 +102,7 @@
"@types/d3": "^7.4.3", "@types/d3": "^7.4.3",
"@types/hast": "^3.0.4", "@types/hast": "^3.0.4",
"@types/js-yaml": "^4.0.9", "@types/js-yaml": "^4.0.9",
"@types/node": "^22.12.0", "@types/node": "^22.13.0",
"@types/pretty-time": "^1.1.5", "@types/pretty-time": "^1.1.5",
"@types/source-map-support": "^0.5.10", "@types/source-map-support": "^0.5.10",
"@types/ws": "^8.5.14", "@types/ws": "^8.5.14",

View File

@ -17,11 +17,17 @@ import { TagContent } from "../../components"
import { write } from "./helpers" import { write } from "./helpers"
import { i18n } from "../../i18n" import { i18n } from "../../i18n"
import DepGraph from "../../depgraph" import DepGraph from "../../depgraph"
import { Data } from "vfile"
interface TagPageOptions extends FullPageLayout { interface TagPageOptions extends FullPageLayout {
sort?: (f1: QuartzPluginData, f2: QuartzPluginData) => number sort?: (f1: QuartzPluginData, f2: QuartzPluginData) => number
} }
const getTags = ({ frontmatter, tagLinks }: Data) => [
...(frontmatter?.tags ?? []),
...(tagLinks ?? []),
]
export const TagPage: QuartzEmitterPlugin<Partial<TagPageOptions>> = (userOpts) => { export const TagPage: QuartzEmitterPlugin<Partial<TagPageOptions>> = (userOpts) => {
const opts: FullPageLayout = { const opts: FullPageLayout = {
...sharedPageComponents, ...sharedPageComponents,
@ -55,7 +61,7 @@ export const TagPage: QuartzEmitterPlugin<Partial<TagPageOptions>> = (userOpts)
for (const [_tree, file] of content) { for (const [_tree, file] of content) {
const sourcePath = file.data.filePath! const sourcePath = file.data.filePath!
const tags = (file.data.frontmatter?.tags ?? []).flatMap(getAllSegmentPrefixes) const tags = getTags(file.data).flatMap(getAllSegmentPrefixes)
// if the file has at least one tag, it is used in the tag index page // if the file has at least one tag, it is used in the tag index page
if (tags.length > 0) { if (tags.length > 0) {
tags.push("index") tags.push("index")
@ -76,9 +82,7 @@ export const TagPage: QuartzEmitterPlugin<Partial<TagPageOptions>> = (userOpts)
const allFiles = content.map((c) => c[1].data) const allFiles = content.map((c) => c[1].data)
const cfg = ctx.cfg.configuration const cfg = ctx.cfg.configuration
const tags: Set<string> = new Set( const tags: Set<string> = new Set(allFiles.flatMap(getTags).flatMap(getAllSegmentPrefixes))
allFiles.flatMap((data) => data.frontmatter?.tags ?? []).flatMap(getAllSegmentPrefixes),
)
// add base tag // add base tag
tags.add("index") tags.add("index")

View File

@ -31,7 +31,7 @@ export interface Options {
wikilinks: boolean wikilinks: boolean
callouts: boolean callouts: boolean
mermaid: boolean mermaid: boolean
parseTags: boolean parseTags: boolean | "link-only"
parseArrows: boolean parseArrows: boolean
parseBlockReferences: boolean parseBlockReferences: boolean
enableInHtmlEmbed: boolean enableInHtmlEmbed: boolean
@ -338,9 +338,13 @@ export const ObsidianFlavoredMarkdown: QuartzTransformerPlugin<Partial<Options>>
} }
tag = slugTag(tag) tag = slugTag(tag)
if (file.data.frontmatter) { if (opts.parseTags != "link-only" && file.data.frontmatter) {
const noteTags = file.data.frontmatter.tags ?? [] const noteTags = file.data.frontmatter.tags ?? []
file.data.frontmatter.tags = [...new Set([...noteTags, tag])] file.data.frontmatter.tags = [...new Set([...noteTags, tag])]
} else {
// We store the content tags so that the tagPage can be generated even
// if there's no pages tagged with them through the frontmatter
file.data.tagLinks = (file.data.tagLinks ?? new Set()).add(tag)
} }
return { return {
@ -828,5 +832,6 @@ declare module "vfile" {
blocks: Record<string, Element> blocks: Record<string, Element>
htmlAst: HtmlRoot htmlAst: HtmlRoot
hasMermaidDiagram: boolean | undefined hasMermaidDiagram: boolean | undefined
tagLinks: Set<string>
} }
} }