quartz/quartz/plugins/transformers/syntax.ts
Copilot 2b63a094fe
docs: complete plugin decoupling with @plugin annotations (#7)
* Initial plan

* Initial analysis and plan for decoupling completion

Co-authored-by: saberzero1 <8161064+saberzero1@users.noreply.github.com>

* docs: add @plugin annotations to transformers missing documentation

Co-authored-by: saberzero1 <8161064+saberzero1@users.noreply.github.com>

* docs: mark decoupling phases and success criteria as complete

Co-authored-by: saberzero1 <8161064+saberzero1@users.noreply.github.com>

* fix: move @plugin annotation in roam.ts to correct location

Move the @plugin documentation block to immediately precede the
RoamFlavoredMarkdown export, consistent with other transformer files
(gfm.ts, syntax.ts, linebreaks.ts). Previously it was placed before
the regex constant declarations.

Co-authored-by: saberzero1 <8161064+saberzero1@users.noreply.github.com>

* Changes before error encountered

Co-authored-by: saberzero1 <8161064+saberzero1@users.noreply.github.com>

* refactor: move documentation files from docs/ to project root

Move IMPLEMENTATION_SUMMARY.md, PLUGIN_MIGRATION.md, and SECURITY_SUMMARY.md
from docs/ directory to project root to keep them separate from user-facing
documentation.

Co-authored-by: saberzero1 <8161064+saberzero1@users.noreply.github.com>

* config: add implementation docs to ignore patterns

Add IMPLEMENTATION_SUMMARY.md, PLUGIN_MIGRATION.md, and SECURITY_SUMMARY.md
to ignorePatterns in quartz.config.ts to exclude them from the documentation
build. These files are implementation documentation for the project itself,
not user-facing documentation.

Co-authored-by: saberzero1 <8161064+saberzero1@users.noreply.github.com>

* chore: remove build output directories from git tracking

Remove public-current and public-v4 directories that were accidentally
committed during build testing. These directories are already covered by
.gitignore and should not be tracked in the repository.

Co-authored-by: saberzero1 <8161064+saberzero1@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: saberzero1 <8161064+saberzero1@users.noreply.github.com>
2025-11-17 02:02:41 +01:00

41 lines
875 B
TypeScript

import { QuartzTransformerPlugin } from "../types"
import rehypePrettyCode, { Options as CodeOptions, Theme as CodeTheme } from "rehype-pretty-code"
interface Theme extends Record<string, CodeTheme> {
light: CodeTheme
dark: CodeTheme
}
interface Options {
theme?: Theme
keepBackground?: boolean
}
const defaultOptions: Options = {
theme: {
light: "github-light",
dark: "github-dark",
},
keepBackground: false,
}
/**
* @plugin SyntaxHighlighting
* @category Transformer
*
* @reads None
* @writes None (adds syntax highlighting to code blocks)
*
* @dependencies None
*/
export const SyntaxHighlighting: QuartzTransformerPlugin<Partial<Options>> = (userOpts) => {
const opts: CodeOptions = { ...defaultOptions, ...userOpts }
return {
name: "SyntaxHighlighting",
htmlPlugins() {
return [[rehypePrettyCode, opts]]
},
}
}