Documentation Guidelines
Core Principles
- Every public API must have JSDoc with a working example
- Every example must have a corresponding test
- Examples must be minimal and focused on one concept
- Documentation must explain WHY, not just WHAT
- Error handling is the PRIMARY selling point
Consistency Across Sources
- mod.ts JSDoc, README.md, and site docs must be consistent
- Same terminology, same examples, same explanations across all three
- Documentation link (https://j50n.github.io/deno-proc/) should be prominent
- “Why proc?” benefits should be consistent
JSDoc Requirements
- Module-level JSDoc in mod.ts appears on JSR overview page
- Include: tagline, documentation link, “Why proc?”, Key Concepts, examples
- Function-level JSDoc should include:
- Clear description
@paramfor all parameters with types@returnswith return type@examplewith working code examples
- Mark technical details as “for advanced users” when appropriate
mdbook Documentation
- All code examples must have test markers:
<!-- TESTED: tests/mdbook_examples.test.ts - "test-name" -->for verified examples<!-- NOT TESTED: Illustrative example -->for conceptual examples
- Use visual callouts with emojis in blockquotes for emphasis
- Organize into clear sections: Getting Started, Core Features, Advanced Topics, etc.
- Include “Key points” explanations after code examples
Documentation Structure
Key Documentation Files
- mod.ts: Module-level JSDoc that appears on JSR overview page
- README.md: GitHub landing page, consistent with mod.ts JSDoc
- site/src/: mdbook documentation with comprehensive guides
Visual Enhancements (mdbook)
- site/theme/custom.css: Professional styling with shadows, rounded corners, hover effects
- site/theme/custom.js: Interactive features like copy buttons and smooth scrolling
- site/book.toml: Navy theme, GitHub integration, enhanced search
Example Standards
- Examples should be copy-paste ready (for TESTED examples)
- Use realistic scenarios, not toy examples
- Include comments explaining non-obvious parts
- Show complete working code, not fragments
- TESTED examples must match documentation exactly
Test Markers
All code examples in mdbook have HTML comments:
<!-- TESTED: tests/mdbook_examples.test.ts - "test-name" -->for verified examples<!-- NOT TESTED: Illustrative example -->for conceptual/comparison examples
Maintenance Guidelines
When Adding New Features
- Add JSDoc to the function/class
- Add example to mod.ts if it’s a common use case
- Update README if it’s a key feature
- Add pattern to patterns.md if it’s a common usage
- Consider if tests should be added
- Mark examples as TESTED or NOT TESTED
When Updating Documentation
- Keep README, mod.ts JSDoc, and site docs consistent
- Use same terminology across all docs
- Add test markers to all code examples
- Run both build scripts to verify
- Check that JSR overview page looks good