From 8d9e04e177a20f8f29d39cc0fc5aa5087a7c11f1 Mon Sep 17 00:00:00 2001 From: rishichawda Date: Mon, 6 Oct 2025 10:22:01 +0530 Subject: [PATCH 01/15] refactor types to their own module Signed-off-by: rishichawda --- index.ts | 98 ++--------------------------------- lib/types/index.ts | 17 +++++++ lib/types/node.ts | 86 +++++++++++++++++++++++++++++++ lib/types/noteTypes.ts | 113 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 220 insertions(+), 94 deletions(-) create mode 100644 lib/types/index.ts create mode 100644 lib/types/node.ts create mode 100644 lib/types/noteTypes.ts diff --git a/index.ts b/index.ts index fd10330..49ab639 100644 --- a/index.ts +++ b/index.ts @@ -1,102 +1,12 @@ import { visit } from 'unist-util-visit' import type { Node } from 'unist' -import type { Blockquote, Paragraph, Text, BlockContent, DefinitionContent } from 'mdast' +import type { Blockquote, Paragraph, Text } from 'mdast' import { readFileSync } from 'fs' import { fileURLToPath } from 'url' import { dirname, join } from 'path' import { toHtml } from 'hast-util-to-html' import { toHast } from 'mdast-util-to-hast' - -interface NoteType { - icon: string - type: string -} - -interface NoteTypes { - [key: string]: NoteType -} - -const noteTypes: NoteTypes = { - 'note': { - icon: ` - - - - - - - - - - - - - - -`, - type: 'note' - }, - 'tip': { - icon: ` - - - - - - -`, - type: 'tip' - }, - 'important': { - icon: ` - - - - - - - -`, - type: 'important' - }, - 'quote': { - icon: ` - - - - - -`, - type: 'quote' - }, - 'bonus': { - icon: ` - - - - - - - -`, - type: 'bonus' - } -} +import { NOTE_TYPES } from './lib/types/index.js' // Get the styles content const __filename = fileURLToPath(import.meta.url) @@ -136,8 +46,8 @@ export default function remarkNotes() { const noteType = match[1].toLowerCase() // Convert to lowercase to match our types - if (noteType in noteTypes) { - const noteConfig = noteTypes[noteType] + if (noteType in NOTE_TYPES) { + const noteConfig = NOTE_TYPES[noteType] // Create a clone of the blockquote children to preserve markdown structure const children = [...node.children] diff --git a/lib/types/index.ts b/lib/types/index.ts new file mode 100644 index 0000000..b443de1 --- /dev/null +++ b/lib/types/index.ts @@ -0,0 +1,17 @@ +/** + * Type definitions for remark-notes-plugin + * + * This module exports all TypeScript types and interfaces used by the plugin. + * It provides type definitions for custom AST nodes, note configurations, + * and type guard utilities. + * + * @module lib/types + */ + +// Note node type definitions +export type { NoteNode } from './node.js' +export { isNoteNode } from './node.js' + +// Note configuration type definitions +export type { NoteType, NoteTypes } from './noteTypes.js' +export { NOTE_TYPES } from './noteTypes.js' diff --git a/lib/types/node.ts b/lib/types/node.ts new file mode 100644 index 0000000..4455d11 --- /dev/null +++ b/lib/types/node.ts @@ -0,0 +1,86 @@ +import type { Node } from 'unist' +import type { BlockContent, DefinitionContent } from 'mdast' + +/** + * Represents a custom note node in the mdast syntax tree. + * This node type is created when a blockquote with the [!type] syntax is encountered. + * + * @example + * ```markdown + * > [!note] + * > This is a note content + * ``` + * + * Transforms to: + * ```typescript + * { + * type: 'note', + * noteType: 'note', + * data: { + * hName: 'div', + * hProperties: { + * className: ['remark-note', 'note'] + * } + * }, + * children: [...] + * } + * ``` + */ +export interface NoteNode extends Node { + /** Node type identifier */ + type: 'note' + + /** The type of note (e.g., 'note', 'tip', 'important', 'quote', 'bonus') */ + noteType: string + + /** + * Data object containing hints for HTML generation (used by rehype). + * These properties tell rehype how to convert this custom node to HTML. + */ + data: { + /** The HTML element name to use when converting to HTML */ + hName: 'div' + + /** HTML attributes/properties for the element */ + hProperties: { + /** CSS classes to apply to the div element */ + className: string[] + } + } + + /** + * Child nodes containing the actual content of the note. + * These remain as markdown AST nodes (paragraphs, lists, code blocks, etc.) + * to preserve markdown features and allow further processing by other plugins. + */ + children: Array +} + +/** + * Type guard to check if a node is a NoteNode + * + * @param node - The node to check + * @returns True if the node is a valid NoteNode + * + * @example + * ```typescript + * if (isNoteNode(node)) { + * console.log(node.noteType) // TypeScript knows this is safe + * } + * ``` + */ +export function isNoteNode(node: unknown): node is NoteNode { + return ( + typeof node === 'object' && + node !== null && + 'type' in node && + node.type === 'note' && + 'noteType' in node && + typeof node.noteType === 'string' && + 'children' in node && + Array.isArray(node.children) && + 'data' in node && + typeof node.data === 'object' && + node.data !== null + ) +} diff --git a/lib/types/noteTypes.ts b/lib/types/noteTypes.ts new file mode 100644 index 0000000..bfa3bf0 --- /dev/null +++ b/lib/types/noteTypes.ts @@ -0,0 +1,113 @@ +/** + * Configuration for a single note type. + * Each note type has an icon (SVG markup) and a type identifier. + */ +export interface NoteType { + /** SVG markup for the note icon */ + icon: string + + /** Type identifier (should match the key in NoteTypes) */ + type: string +} + +/** + * Collection of all available note types. + * Keys are the note type identifiers (lowercase) that users can use in markdown. + * + * @example + * ```markdown + * > [!note] + * > This uses the 'note' type + * + * > [!tip] + * > This uses the 'tip' type + * ``` + */ +export interface NoteTypes { + [key: string]: NoteType +} + +/** + * Built-in note types supported by the plugin. + */ +export const NOTE_TYPES: NoteTypes = { + 'note': { + icon: ` + + + + + + + + + + + + + + +`, + type: 'note' + }, + 'tip': { + icon: ` + + + + + + +`, + type: 'tip' + }, + 'important': { + icon: ` + + + + + + + +`, + type: 'important' + }, + 'quote': { + icon: ` + + + + + +`, + type: 'quote' + }, + 'bonus': { + icon: ` + + + + + + + +`, + type: 'bonus' + } +} From 767af5c3bb3c986b162a46aa516af96c17574c7d Mon Sep 17 00:00:00 2001 From: rishichawda Date: Mon, 6 Oct 2025 11:12:34 +0530 Subject: [PATCH 02/15] update node creation and refactor style injection Signed-off-by: rishichawda --- index.ts | 156 ++++++++++++++++++++++++++------------------------ lib/styles.ts | 17 ++++++ 2 files changed, 99 insertions(+), 74 deletions(-) create mode 100644 lib/styles.ts diff --git a/index.ts b/index.ts index 49ab639..c34c384 100644 --- a/index.ts +++ b/index.ts @@ -1,101 +1,109 @@ import { visit } from 'unist-util-visit' -import type { Node } from 'unist' +import type { Node, Parent } from 'unist' import type { Blockquote, Paragraph, Text } from 'mdast' -import { readFileSync } from 'fs' -import { fileURLToPath } from 'url' -import { dirname, join } from 'path' -import { toHtml } from 'hast-util-to-html' -import { toHast } from 'mdast-util-to-hast' +import type { NoteNode } from './lib/types/index.js' import { NOTE_TYPES } from './lib/types/index.js' - -// Get the styles content -const __filename = fileURLToPath(import.meta.url) -const __dirname = dirname(__filename) -// Look for styles.css in the package root (one level up from dist) -const stylesPath = join(__dirname, 'styles.css') -const styles = readFileSync(stylesPath, 'utf-8') +import { styles } from './lib/styles.js' export default function remarkNotes() { - return (tree: Node) => { - let hasInjectedStyles = false; + let hasInjectedStyles = false - visit(tree, 'root', (node: any) => { - if (!hasInjectedStyles) { - // Inject styles at the beginning of the document - node.children.unshift({ + return (tree: Node) => { + // Inject styles at the beginning of the document (only once) + if (!hasInjectedStyles) { + const root = tree as Parent + if (root.children) { + root.children.unshift({ type: 'html', value: `` - }); - hasInjectedStyles = true; + } as any) + hasInjectedStyles = true } - }); + } - visit(tree, 'blockquote', (node: Blockquote) => { - const firstParagraph = node.children[0] as Paragraph - if (!firstParagraph) return + visit(tree, 'blockquote', (node: Blockquote, index, parent) => { + // Validate we have parent and index for proper node replacement + if (!parent || index === null || index === undefined) return + + const firstParagraph = node.children[0] + if (!firstParagraph || firstParagraph.type !== 'paragraph') return const firstChild = firstParagraph.children[0] if (!firstChild || firstChild.type !== 'text') return const textNode = firstChild as Text - if (!textNode) return - // Updated pattern to match [!type] + // Match [!type] pattern const match = textNode.value.match(/^\[!(\w+)\]/) if (!match) return - const noteType = match[1].toLowerCase() // Convert to lowercase to match our types + const noteType = match[1].toLowerCase() - if (noteType in NOTE_TYPES) { - const noteConfig = NOTE_TYPES[noteType] - - // Create a clone of the blockquote children to preserve markdown structure - const children = [...node.children] + // Only transform if it's a recognized note type + if (!(noteType in NOTE_TYPES)) return + + // Clone children to preserve original markdown structure + const children = [...node.children] + + // Process the first paragraph to remove the note marker + if (children.length > 0 && children[0].type === 'paragraph') { + const firstPara = children[0] as Paragraph + const firstTextNode = firstPara.children[0] as Text - // Process the first paragraph to remove the note marker - if (children.length > 0 && children[0].type === 'paragraph') { - const firstPara = children[0] as Paragraph - const firstTextNode = firstPara.children[0] as Text + if (firstTextNode && firstTextNode.type === 'text') { + // Remove the [!type] marker and any trailing whitespace + firstTextNode.value = firstTextNode.value.replace(/^\[!\w+\]\s*/, '') - if (firstTextNode && firstTextNode.type === 'text') { - // Only remove the marker from the text content - firstTextNode.value = firstTextNode.value.replace(/^\[!\w+\]\s*/, '') - - // If the text node is now empty and it's the only child, remove it - if (firstTextNode.value === '' && firstPara.children.length === 1) { - children.shift() - } + // If the text node is now empty and it's the only child, remove the paragraph + if (firstTextNode.value === '' && firstPara.children.length === 1) { + children.shift() } } - - // Convert the modified markdown structure to HTML - const contentHast = toHast({ - type: 'root', - children: children - }) as any - - // Convert hast to HTML string - const contentHtml = contentHast ? toHtml(contentHast) : '' - - // Create HTML structure using classes - const html = { - type: 'html', - value: ` -
-
- ${noteConfig.icon} - ${noteType} -
-
- ${contentHtml} -
-
- ` - } - - // Replace the blockquote with our HTML - Object.assign(node, html) } + + // Get the icon for this note type + const noteConfig = NOTE_TYPES[noteType] + const icon = noteConfig.icon + + // Create header with icon and title + const headerNode = { + type: 'html', + value: `
${icon}${noteType}
` + } + + const contentWrapperStart = { + type: 'html', + value: '
' + } + + const contentWrapperEnd = { + type: 'html', + value: '
' + } + + // Wrap content with header and content wrapper + const wrappedChildren = [ + headerNode, + contentWrapperStart, + ...children, + contentWrapperEnd + ] + + // Create the custom NoteNode + const noteNode = { + type: 'note', + noteType: noteType, + data: { + hName: 'div', + hProperties: { + className: ['remark-note', noteType] + } + }, + children: wrappedChildren + } as NoteNode + + // Replace the blockquote with the note node in the parent + (parent as Parent).children[index] = noteNode as any }) } -} \ No newline at end of file +} diff --git a/lib/styles.ts b/lib/styles.ts new file mode 100644 index 0000000..f2b83c3 --- /dev/null +++ b/lib/styles.ts @@ -0,0 +1,17 @@ +/** + * CSS styles for remark-notes + * Loaded once at module initialization + */ + +import { readFileSync } from 'fs' +import { fileURLToPath } from 'url' +import { dirname, join } from 'path' + +const __filename = fileURLToPath(import.meta.url) +const __dirname = dirname(__filename) + +// Read CSS file once at module load time +const cssPath = join(__dirname, '..', 'styles.css') +export const styles = readFileSync(cssPath, 'utf-8') + +export default styles From 98ae5468cc8939933de6f1e784d3ab6bbd5c1ede Mon Sep 17 00:00:00 2001 From: rishichawda Date: Mon, 6 Oct 2025 11:41:11 +0530 Subject: [PATCH 03/15] refactor tests Signed-off-by: rishichawda --- __tests__/README.md | 80 ++++++++++++++ __tests__/__fixtures__/bonus/input.md | 3 + __tests__/__fixtures__/bonus/output.html | 15 +++ __tests__/__fixtures__/important/input.md | 3 + __tests__/__fixtures__/important/output.html | 10 ++ __tests__/__fixtures__/note/input.md | 3 + __tests__/__fixtures__/note/output.html | 18 ++++ __tests__/__fixtures__/quote/input.md | 3 + __tests__/__fixtures__/quote/output.html | 12 +++ __tests__/__fixtures__/tip/input.md | 3 + __tests__/__fixtures__/tip/output.html | 14 +++ __tests__/generate-fixtures.ts | 43 ++++++++ __tests__/index.ts | 62 +++++++++++ __tests__/styles.ts | 63 +++++++++++ package.json | 16 ++- test.ts | 65 ------------ tsconfig.json | 8 +- yarn.lock | 104 ++++++++++++++++++- 18 files changed, 454 insertions(+), 71 deletions(-) create mode 100644 __tests__/README.md create mode 100644 __tests__/__fixtures__/bonus/input.md create mode 100644 __tests__/__fixtures__/bonus/output.html create mode 100644 __tests__/__fixtures__/important/input.md create mode 100644 __tests__/__fixtures__/important/output.html create mode 100644 __tests__/__fixtures__/note/input.md create mode 100644 __tests__/__fixtures__/note/output.html create mode 100644 __tests__/__fixtures__/quote/input.md create mode 100644 __tests__/__fixtures__/quote/output.html create mode 100644 __tests__/__fixtures__/tip/input.md create mode 100644 __tests__/__fixtures__/tip/output.html create mode 100644 __tests__/generate-fixtures.ts create mode 100644 __tests__/index.ts create mode 100644 __tests__/styles.ts delete mode 100644 test.ts diff --git a/__tests__/README.md b/__tests__/README.md new file mode 100644 index 0000000..3c74e78 --- /dev/null +++ b/__tests__/README.md @@ -0,0 +1,80 @@ +# Tests + +## Test Structure + +### Test Files + +- **`index.ts`**: Fixture-based tests for plugin transformation + - Tests each note type (note, tip, important, quote, bonus) + - Compares actual output against known-good expected output + - Uses `rehype-parse` to parse HTML into HAST for structural comparison + - Strips position data for stable comparisons + +- **`styles.ts`**: Tests for automatic style injection + - Verifies styles are automatically injected + - Ensures styles are injected only once per document + - Validates CSS content is not empty + +- **`generate-fixtures.ts`**: Utility script to regenerate expected outputs + - Run when you make intentional changes to plugin output. MUST be done with caution. + - Updates all fixture outputs to match current implementation + +### Fixtures Directory (`__fixtures__/`) + +Each note type has its own directory containing: + +- `input.md`: Sample markdown input for that note type +- `output.html`: Expected HTML output (auto-generated) + +Structure: + +``` +__fixtures__/ +├── note/ +│ ├── input.md +│ └── output.html +├── tip/ +│ ├── input.md +│ └── output.html +├── important/ +│ ├── input.md +│ └── output.html +├── quote/ +│ ├── input.md +│ └── output.html +└── bonus/ + ├── input.md + └── output.html +``` + +## Running Tests + +```bash +# Run all tests +yarn test + +# Run fixture tests only +yarn test:fixtures + +# Run style injection tests only +yarn test:styles + +# Regenerate expected outputs after changes +yarn generate:fixtures +``` + +## Testing Approach + +1. **Fixture-based testing**: Instead of inline test data, we use separate files for inputs and expected outputs +2. **Structural comparison**: Uses `rehype-parse` to parse HTML into HAST (Hypertext Abstract Syntax Tree) for comparison +3. **Position-agnostic**: Strips position data from HAST to avoid tests that break on whitespace changes +4. **Separation of concerns**: Plugin transformation tests are separate from style injection tests + +## Adding New Test Cases + +To add a new test case: + +1. Create a new directory in `__fixtures__/` (e.g., `__fixtures__/new-type/`) +2. Add `input.md` with your test markdown +3. Run `yarn generate:fixtures` to auto-generate the expected `output.html` +4. Add the new type to the `FIXTURE_TYPES` array in `index.ts` diff --git a/__tests__/__fixtures__/bonus/input.md b/__tests__/__fixtures__/bonus/input.md new file mode 100644 index 0000000..6d6f859 --- /dev/null +++ b/__tests__/__fixtures__/bonus/input.md @@ -0,0 +1,3 @@ +> [!bonus] +> This is a bonus block. +> Extra info for advanced users. \ No newline at end of file diff --git a/__tests__/__fixtures__/bonus/output.html b/__tests__/__fixtures__/bonus/output.html new file mode 100644 index 0000000..35e232c --- /dev/null +++ b/__tests__/__fixtures__/bonus/output.html @@ -0,0 +1,15 @@ +
+ + + + + + + +bonus

This is a bonus block. +Extra info for advanced users.

\ No newline at end of file diff --git a/__tests__/__fixtures__/important/input.md b/__tests__/__fixtures__/important/input.md new file mode 100644 index 0000000..0739edb --- /dev/null +++ b/__tests__/__fixtures__/important/input.md @@ -0,0 +1,3 @@ +> [!important] +> This is an important block. +> Pay attention to this! \ No newline at end of file diff --git a/__tests__/__fixtures__/important/output.html b/__tests__/__fixtures__/important/output.html new file mode 100644 index 0000000..3b19b60 --- /dev/null +++ b/__tests__/__fixtures__/important/output.html @@ -0,0 +1,10 @@ +
+ + + + + + + +important

This is an important block. +Pay attention to this!

\ No newline at end of file diff --git a/__tests__/__fixtures__/note/input.md b/__tests__/__fixtures__/note/input.md new file mode 100644 index 0000000..955e6f7 --- /dev/null +++ b/__tests__/__fixtures__/note/input.md @@ -0,0 +1,3 @@ +> [!note] +> This is a note block. +> It supports **bold** and *italic* text. \ No newline at end of file diff --git a/__tests__/__fixtures__/note/output.html b/__tests__/__fixtures__/note/output.html new file mode 100644 index 0000000..01a120c --- /dev/null +++ b/__tests__/__fixtures__/note/output.html @@ -0,0 +1,18 @@ +
+ + + + + + + + + + + + + + +note

This is a note block. +It supports bold and italic text.

\ No newline at end of file diff --git a/__tests__/__fixtures__/quote/input.md b/__tests__/__fixtures__/quote/input.md new file mode 100644 index 0000000..633b3e4 --- /dev/null +++ b/__tests__/__fixtures__/quote/input.md @@ -0,0 +1,3 @@ +> [!quote] +> This is a quote block. +> "To be or not to be." \ No newline at end of file diff --git a/__tests__/__fixtures__/quote/output.html b/__tests__/__fixtures__/quote/output.html new file mode 100644 index 0000000..f2756ed --- /dev/null +++ b/__tests__/__fixtures__/quote/output.html @@ -0,0 +1,12 @@ +
+ + + + + +quote

This is a quote block. +"To be or not to be."

\ No newline at end of file diff --git a/__tests__/__fixtures__/tip/input.md b/__tests__/__fixtures__/tip/input.md new file mode 100644 index 0000000..e7ea50a --- /dev/null +++ b/__tests__/__fixtures__/tip/input.md @@ -0,0 +1,3 @@ +> [!tip] +> This is a tip block. +> Use it for helpful advice. \ No newline at end of file diff --git a/__tests__/__fixtures__/tip/output.html b/__tests__/__fixtures__/tip/output.html new file mode 100644 index 0000000..0532871 --- /dev/null +++ b/__tests__/__fixtures__/tip/output.html @@ -0,0 +1,14 @@ +
+ + + + + + +tip

This is a tip block. +Use it for helpful advice.

\ No newline at end of file diff --git a/__tests__/generate-fixtures.ts b/__tests__/generate-fixtures.ts new file mode 100644 index 0000000..eb92fc2 --- /dev/null +++ b/__tests__/generate-fixtures.ts @@ -0,0 +1,43 @@ +import { readFileSync, writeFileSync } from 'fs' +import { join, dirname } from 'path' +import { fileURLToPath } from 'url' +import { unified } from 'unified' +import remarkParse from 'remark-parse' +import remarkNotes from '../index.js' +import remarkRehype from 'remark-rehype' +import rehypeStringify from 'rehype-stringify' + +const __filename = fileURLToPath(import.meta.url) +const __dirname = dirname(__filename) + +const FIXTURE_TYPES = ['note', 'tip', 'important', 'quote', 'bonus'] +const FIXTURE_DIR = join(__dirname, '__fixtures__') + +async function generateFixtures() { + for (const type of FIXTURE_TYPES) { + const inputPath = join(FIXTURE_DIR, type, 'input.md') + const outputPath = join(FIXTURE_DIR, type, 'output.html') + + const inputMd = readFileSync(inputPath, 'utf8') + + // Run plugin pipeline + const result = await unified() + .use(remarkParse) + .use(remarkNotes) + .use(remarkRehype, { allowDangerousHtml: true }) + .use(rehypeStringify, { allowDangerousHtml: true }) + .process(inputMd) + + let html = String(result) + + // Remove the style tag for cleaner fixtures + html = html.replace(/` + type: 'paragraph', + data: { + hName: 'style', + hProperties: {} + }, + children: [{ + type: 'text', + value: styles + }] } as any) hasInjectedStyles = true } From 1f726fe291709e1d1675d865d211667c124a77ff Mon Sep 17 00:00:00 2001 From: rishichawda Date: Mon, 6 Oct 2025 19:17:21 +0530 Subject: [PATCH 14/15] export module in all the ways Signed-off-by: rishichawda --- package.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 9dbffc2..62bacab 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,9 @@ "exports": { ".": { "types": "./dist/index.d.ts", - "import": "./dist/index.js" + "import": "./dist/index.js", + "require": "./dist/index.js", + "default": "./dist/index.js" }, "./styles.css": "./dist/styles.css" }, From caedb8ec3536e66652357bdc0a51dbecab3c066c Mon Sep 17 00:00:00 2001 From: rishichawda Date: Mon, 6 Oct 2025 19:29:01 +0530 Subject: [PATCH 15/15] add test workflow Signed-off-by: rishichawda --- .github/workflows/test.yml | 74 ++++++++++++++++++++++++++++++++++++++ README.md | 2 +- 2 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..4618aa8 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,74 @@ +name: Test + +on: + pull_request: + branches: [main] + paths: + - 'lib/**' + - 'index.ts' + - 'styles.css' + - 'package.json' + - '__tests__/**' + - 'tsconfig.json' + - '.github/workflows/test.yml' + push: + branches: [main] + paths: + - 'lib/**' + - 'index.ts' + - 'styles.css' + - 'package.json' + - '__tests__/**' + - 'tsconfig.json' + - '.github/workflows/test.yml' + +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [18, 20, 22] + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: 'yarn' + + - name: Install dependencies + run: yarn install --frozen-lockfile + + - name: Build package + run: yarn build + + - name: Run all tests + run: yarn test:all + + - name: Check for TypeScript errors + run: yarn build:ts + + lint: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '22' + cache: 'yarn' + + - name: Install dependencies + run: yarn install --frozen-lockfile + + - name: Build package + run: yarn build + + - name: Check TypeScript types + run: yarn build:ts --noEmit diff --git a/README.md b/README.md index 08e0ee2..53e2d3b 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ A powerful TypeScript remark plugin that transforms markdown blockquotes into beautifully styled note elements. Add professional-looking notes, tips, quotes, and more to your markdown documentation with minimal effort! -![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/rishichawda/remark-notes-plugin/release.yml) +![Test Status](https://img.shields.io/github/actions/workflow/status/rishichawda/remark-notes-plugin/test.yml?branch=main&label=tests) ![npm](https://img.shields.io/npm/v/remark-notes-plugin) ![License](https://img.shields.io/npm/l/remark-notes-plugin) ![Website](https://img.shields.io/website?url=https%3A%2F%2Frishichawda.github.io%2Fremark-notes-plugin)