Guidelines for AI coding agents (Claude, Gemini, Codex).
Writr is a Node.js markdown rendering library built with TypeScript. It simplifies markdown-to-HTML conversion by removing remark/unified complexity while leveraging the powerful unified processor ecosystem. Key features include built-in caching, frontmatter support, React rendering, GitHub Flavored Markdown (GFM), syntax highlighting, math support, and hook/event capabilities via hookified.
pnpm install- Install dependenciespnpm build- Build for production (ESM + type definitions)pnpm lint- Run Biome linter with auto-fixpnpm test- Run linter and Vitest with coveragepnpm test:ci- CI-specific testing (strict linting + coverage)pnpm benchmark- Run performance benchmarkspnpm clean- Remove node_modules, coverage, and dist directoriespnpm website:build- Build documentation websitepnpm website:serve- Serve documentation website locally
Use pnpm, not npm.
- Always run
pnpm buildbefore committing - Build must succeed - Always run
pnpm testbefore committing - All tests must pass - Follow existing code style - Biome enforces formatting and linting
- Mirror source structure in tests - Test files go in
test/matchingsrc/structure - Maintain ESM-only compatibility - This is an ESM-only package
- Test on Node.js >= 22 - Minimum supported version is Node 22
src/writr.ts- Main Writr class with markdown rendering, React support, and file operationssrc/writr-cache.ts- Caching implementation using Cacheabletest/- Test files (Vitest) mirroring src structuretest/content-fixtures.ts- Shared test markdown content and fixturesbenchmark/- Performance benchmarks using tinybenchsite/- Documentation website (built with docula)
- unified/remark/rehype - Core markdown processing pipeline
- hookified - Hook and event emitter capabilities
- cacheable - Built-in caching system
- react - React component rendering support
- biome - Linting and formatting
- vitest - Testing framework with coverage