This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
wiremd is a text-first UI design tool that allows developers to create wireframes and mockups using Markdown syntax.
Core Library (markdown-mockup or wiremd) - MIT-licensed parser and renderer
Current Status: ~75% of Phase 1 complete - Core parser and HTML renderer implemented with 48 passing tests. See markdown-mockup-project-plan.md for full roadmap.
Core Library:
- TypeScript (strict mode) - Simplified using discriminated unions
- Build: Vite + vite-plugin-dts
- Parser: Unified/Remark + Custom plugins
- Testing: Vitest (48 tests passing)
- Documentation: VitePress (planned)
markdown-mockup/
├── src/
│ ├── parser/ # Markdown + mockup syntax parser
│ │ ├── index.ts # Main parser entry
│ │ ├── transformer.ts # MDAST to wiremd AST
│ │ ├── remark-containers.ts # ::: syntax plugin
│ │ └── remark-inline-containers.ts # [[...]] syntax plugin
│ ├── renderer/ # HTML/JSON renderer
│ │ ├── index.ts # Main renderer entry
│ │ ├── html-renderer.ts # Component HTML generation
│ │ └── styles.ts # Visual styles (default: sketch/Balsamiq)
│ ├── types.ts # TypeScript types (176 lines, simplified)
│ └── index.ts # Library entry point
├── tests/ # Test suite
│ ├── parser.test.ts # Parser tests (29 tests)
│ └── renderer.test.ts # Renderer tests (19 tests)
├── docs/ # Documentation site (coming soon)
└── examples/ # Example mockup files
The parser will follow this pipeline:
Markdown Input → Lexer (Tokenization) → Parser (AST) →
Transformer (AST → JSON) → Validator → Output (JSON/HTML/Framework)
- Feel like native Markdown where possible
- Progressive enhancement - basic Markdown should still work
- Custom syntax only when necessary
- Clear ambiguity resolution rules
The parser will output a structured JSON format with:
- Document metadata (version, viewport, annotations)
- Component tree with types, props, children, layout
- Style definitions
- State representations (hover, active, disabled, loading, etc.)
Supported UI components will include:
- Layout: container, section, header, footer, grid
- Forms: button, input, textarea, select, form
- Content: text, heading, paragraph, image, icon
- Navigation: nav, nav-item
- Complex: card, modal, table
HTML renderer uses Balsamiq-inspired hand-drawn style by default (sketch).
Default Style:
sketch- Balsamiq-inspired hand-drawn look with Comic Sans, rotated elements, and shadows
Alternative Styles (examples in /examples/styles/):
clean- Modern minimal design with system fontswireframe- Traditional grayscale with hatching patternsnone- Unstyled semantic HTML for custom CSS
Users can switch styles via CLI flag: --style clean
# Install dependencies
npm install
# Build library
npm run build
# Run tests
npm test
# Run tests in watch mode
npm test -- --watch
# Run specific test file
npm test -- path/to/test.spec.ts
# Lint code
npm run lint
# Type check
npm run typecheck
# Start documentation dev server
npm run docs:dev# Parse and render mockup (uses Balsamiq-style by default)
wiremd input.md
# Output to file
wiremd input.md -o output.html
# JSON output
wiremd input.md --format json
# Watch mode with dev server and live-reload
wiremd input.md --watch --serve 3000
# Use alternative visual styles (examples in /examples/styles/)
wiremd input.md --style clean # Modern minimal
wiremd input.md --style wireframe # Traditional grayscale
wiremd input.md --style none # Unstyled semantic HTML- Each component type must have comprehensive unit tests
- Parser tokenization and transformation tests
- Renderer output tests for all styles
- Full document parsing end-to-end
- Complex nested component scenarios
- Edge cases and error conditions
- Minimum 50% test coverage (target: 80%+)
- All exported functions must be tested
- Error messages must be clear and actionable
- Performance: <100ms parse time for typical documents
Currently supported:
- HTML with inline styles
- JSON (AST output)
Planned:
- React components
- Vue components
- Svelte components
- HTML with external CSS
- PDF wireframes (via headless browser)
- Core library: MIT License - fully open source
- Parse time: <100ms for typical document
- Render time: <200ms for HTML generation
- Memory: <50MB for large documents
- Node.js: 18+
- Browsers: Modern evergreen (ES2020+)
## Navigation Bar {.sticky .top}
[[ Logo | Home | Products | About | [Sign In] ]]
## Hero Section {.hero}
> # Welcome to Our Product
> Transform your workflow
> [Get Started] [Learn More]{.outline}
## Features Grid {.grid-3}
### Feature One

Fast and reliable service.
## Contact Form
[Name___________]
[Email__________] {type:email required}
[Your message...] {rows:5}
[Submit]- Research existing solutions
- Build test corpus with 20 common UI patterns
- Lock v0.1 syntax specification
- Implement lexer, parser, AST transformer
- Create JSON schema
- Add validation layer
- Build Balsamiq-style CSS framework
- Implement HTML generator
- Support multiple visual styles
- Basic commands
- Watch mode and dev server
- Config file support
- React component renderer
- Vue component renderer
- Svelte component renderer
- VS Code extension with live preview
The following key decisions need to be made during implementation:
- Layout system: CSS Grid vs. Table-like vs. Flexbox hints
- Component syntax: Which style for buttons, inputs, images
- Modifier syntax: How to express classes, IDs, properties
- State representation: Syntax for hover, active, disabled states
- Responsive syntax: Inline modifiers vs. viewport blocks
- Tokenization strategy
- AST structure
- Error recovery approach
- Plugin API integration points
See markdown-mockup-project-plan.md section 1.2 for detailed syntax options under consideration.
Before writing any code:
- Review the full project plan in
markdown-mockup-project-plan.md - Confirm syntax decisions with the user
- Set up monorepo structure with proper tooling
- Establish testing framework first
- Create initial TypeScript types for AST and JSON schema
- Build minimal parser before adding features
- 100 GitHub stars in first month
- 1,000 npm downloads in first month
- <100ms parse time for typical documents
- 50%+ test coverage
- All TypeScript strict mode checks passing
- Zero ESLint errors
- Comprehensive JSDoc for public APIs
- Clear error messages with suggestions