From d4887fcdddd79c20d0aa53cb650f699e1a17dfcd Mon Sep 17 00:00:00 2001 From: rishichawda Date: Fri, 10 Oct 2025 18:49:35 +0530 Subject: [PATCH] update documentation Signed-off-by: rishichawda --- docs/docs/api/overview.md | 354 ++++++++++ docs/docs/customization/styling.md | 648 ++++++++++++++++++ docs/docs/examples/note-types.mdx | 393 +++++++++-- docs/docs/guides/frameworks.md | 516 ++++++++++++++ docs/docs/guides/troubleshooting.md | 564 +++++++++++++++ docs/docs/intro.md | 235 ++++++- docs/docusaurus.config.ts | 120 +++- docs/sidebars.ts | 35 +- .../src/components/HomepageFeatures/index.tsx | 104 ++- .../HomepageFeatures/styles.module.css | 144 +++- docs/src/css/custom.css | 325 +++++++-- docs/src/pages/index.module.css | 265 ++++++- docs/src/pages/index.tsx | 184 ++++- 13 files changed, 3684 insertions(+), 203 deletions(-) create mode 100644 docs/docs/api/overview.md create mode 100644 docs/docs/customization/styling.md create mode 100644 docs/docs/guides/frameworks.md create mode 100644 docs/docs/guides/troubleshooting.md diff --git a/docs/docs/api/overview.md b/docs/docs/api/overview.md new file mode 100644 index 0000000..563cac2 --- /dev/null +++ b/docs/docs/api/overview.md @@ -0,0 +1,354 @@ +--- +sidebar_position: 1 +--- + +# API Reference + +Complete TypeScript API reference for `remark-notes-plugin`. + +## Plugin Function + +### `remarkNotes(options?)` + +The main plugin function that transforms markdown blockquotes into styled note elements. + +**Type Signature:** + +```typescript +function remarkNotes(options?: RemarkNotesOptions): (tree: Node) => void +``` + +**Parameters:** + +- `options` (optional): Configuration object of type `RemarkNotesOptions` + +**Returns:** + +A transformer function that processes the AST (Abstract Syntax Tree). + +**Example:** + +```typescript +import { unified } from 'unified'; +import remarkParse from 'remark-parse'; +import remarkNotes from 'remark-notes-plugin'; +import remarkRehype from 'remark-rehype'; +import rehypeStringify from 'rehype-stringify'; + +const processor = unified() + .use(remarkParse) + .use(remarkNotes, { classPrefix: 'custom' }) + .use(remarkRehype) + .use(rehypeStringify); + +const result = await processor.process('> [!note]\n> This is a note'); +``` + +## Configuration Options + +### `RemarkNotesOptions` + +Configuration interface for the plugin. + +```typescript +interface RemarkNotesOptions { + classPrefix?: string; + injectStyles?: boolean; +} +``` + +#### `classPrefix` + +Custom prefix for all generated CSS class names. + +- **Type:** `string` +- **Default:** `''` (empty string - no prefix) +- **Optional:** Yes + +The prefix is **prepended** to the standard `remark-note` class names. + +**Default behavior (no prefix):** +```html +
+
+ ... + tip +
+
...
+
+``` + +**With prefix (e.g., `'my'`):** +```html +
+
+ ... + tip +
+
...
+
+``` + +**Example:** + +```typescript +unified().use(remarkNotes, { classPrefix: 'docs' }); +// Generates: docs-remark-note, docs-remark-note-tip, etc. +``` + +> [!note] +> The shipped CSS uses attribute selectors (e.g., `[class*="remark-note-icon"]`) and will work automatically with any prefix. + +#### `injectStyles` + +Controls whether the plugin automatically injects styles into the document. + +- **Type:** `boolean` +- **Default:** `true` +- **Optional:** Yes + +When `true`, the plugin injects a `