Thanks for your interest in improving h2m-parser! Keeping cognitive load low is the primary goal—prefer straightforward solutions and resist clever abstractions unless they demonstrably reduce maintenance overhead.
- Ensure Node.js 20.11+ and Bun 1.2+ are installed.
- Install dependencies:
bun install. - Build and verify:
bun verifyor run scripts individually (bun lint,bun typecheck,bun test).
- Write TypeScript in
src/and keep exports explicit insrc/index.ts. - Favor early returns and descriptive helper functions to keep cognitive load low—see
cognitive-load.mdfor the philosophy behind our style. - Prefer pure functions; when mutating shared state, encapsulate the mutation and document it.
- Keep custom translators compact—wrap individual tags with clear helpers instead of adding deep inheritance or cross-cutting state.
- Use Biome for formatting and linting (
bun lint:fix,bun format:fix). - Maintain exhaustive unit tests alongside new functionality (
tests/). When adding HTML fixtures, store inputs undertests/fixtures/with matching Markdown expectations.
- Husky runs
lint-stagedto format/lint staged files. Make sure your commits are clean. - Use Changesets for release notes. After feature work, run
bun changesetto document changes and version bumps. - When the release PR opens, review the changelog and, after merging, approve the pending run in the
releaseenvironment to publish. - CI runs
bun lint,bun typecheck,bun test, andbun run build. Keep theverifyscript green locally before pushing.
Open GitHub issues with:
- A minimal reproduction (HTML snippet, options used).
- Expected Markdown output and actual output.
- Environment details (Node.js version, operating system).
- Is the implementation linear and searchable without jumping across many files?
- Are edge cases covered by unit tests or documented assumptions?
- Does new configuration default to sensible values to minimize user surprise?
Thanks for helping keep h2m-parser simple and reliable!
# Quick quality checks (10 seconds)
bun qa:quick
# Full regression test (30 seconds)
bun regression
# Complete QA with validation (2-3 minutes)
bun qa
# Development watch mode
bun run build:watch # Terminal 1
bun test:watch # Terminal 2| Script | Purpose | Duration | When to Use |
|---|---|---|---|
bun qa:quick |
Quick validation: lint, types, tests, export | ~10s | Before commits |
bun qa |
Full QA with markdown validation | ~2-3min | Before PRs |
bun regression |
Basic regression test | ~30s | After changes |
bun regression:full |
Complete regression suite | ~1-2min | Before releases |
| Script | Purpose | Duration | When to Use |
|---|---|---|---|
bun bench:quick |
Quick performance check | ~5s | During development |
bun bench:compare:quick |
Fast comparison with competitors | ~10s | After optimizations |
bun bench:compare |
Full comparison benchmark | ~2min | Before releases |
bun bench:profile |
Detailed performance profiling | ~30s | Performance debugging |
bun bench:analyze |
Pipeline analysis | ~30s | Optimization work |
| Script | Purpose | Duration | When to Use |
|---|---|---|---|
bun bench:export |
Generate markdown outputs | ~5s | Testing conversions |
bun bench:export:validate |
Export + validate with markdownlint | ~10s | Quality checks |
bun bench:readme:generate |
Generate all benchmark reports | ~3min | Before releases |
# Start development
bun run build:watch # In terminal 1
bun test:watch # In terminal 2
# After making changes
bun qa:quick # Quick validation
bun bench:export # Check output quality# Standard pre-commit check
bun regression
# Or if you want to be thorough
bun qa# Before optimization
bun bench:compare:quick > before.txt
# After optimization
bun bench:compare:quick > after.txt
# Detailed analysis
bun bench:profile
bun bench:analyze# Full validation
bun regression:full
# Generate all reports
bun bench:readme:generate
# Update changelog
bun changeset
# Release
bun releaseThe bench/output/ directory contains markdown outputs from different converters:
bench/output/h2m-parser/- Our outputsbench/output/turndown/- Turndown outputsbench/output/node-html-markdown/- node-html-markdown outputs
To validate output quality:
# Generate fresh outputs and validate
bun bench:export:validate
# Check specific issues
npx markdownlint bench/output/h2m-parser/*.md
# Compare with competitors
npx markdownlint bench/output/*/*.md 2>&1 | grep -c "^bench"Current performance targets (from benchmarks):
- Without Readability: ~1-3ms for typical web pages
- With Readability: ~5-10ms for typical web pages
- vs Turndown: Should be within 1-2x
- vs node-html-markdown: Should be competitive or faster
# Run specific test
bun test -- htmlparser2-default-tags.test.ts
# Update snapshots if needed
bun test -- -u# Quick comparison
bun bench:compare:quick
# Detailed profiling
node --expose-gc bench/profile.js --memory# Check specific file
npx markdownlint bench/output/h2m-parser/[filename].md
# See all issues
bun bench:export:validate