Thank you for your interest in contributing to djot-php!
# Clone the repository
git clone https://github.com/php-collective/djot-php.git
cd djot-php
# Install dependencies
composer install# Run all tests
composer test
# Run only project tests (excludes official djot spec tests)
vendor/bin/phpunit --testsuite own
# Run only the official djot test suite
vendor/bin/phpunit --testsuite official
# Run a specific test file
vendor/bin/phpunit tests/TestCase/DjotConverterTest.php
# Run a specific test method
vendor/bin/phpunit --filter testHeading| Suite | Description |
|---|---|
default |
All tests |
own |
Project tests only (recommended for development) |
official |
Official djot specification tests |
The own suite excludes the official test suite which may have expected failures due to implementation differences.
This project follows PHP Collective coding standards.
# Check code style
composer cs-check
# Auto-fix code style issues
composer cs-fix# Run PHPStan (level 8)
composer stan# Run all checks (code style + tests)
composer checksrc/
├── DjotConverter.php # Main entry point
├── Parser/
│ ├── BlockParser.php # Block-level parsing
│ └── InlineParser.php # Inline content parsing
├── Renderer/
│ ├── HtmlRenderer.php # HTML output
│ ├── PlainTextRenderer.php
│ └── MarkdownRenderer.php
├── Node/ # AST node classes
│ ├── Block/ # Block-level nodes
│ └── Inline/ # Inline nodes
└── Event/
└── RenderEvent.php # Render customization events
Tests are located in tests/TestCase/. Follow the existing patterns:
public function testFeatureName(): void
{
$djot = "input text";
$expected = "<p>expected output</p>\n";
$this->assertSame($expected, $this->converter->convert($djot));
}For tests that check partial output:
public function testFeatureContains(): void
{
$result = $this->converter->convert($djot);
$this->assertStringContainsString('expected part', $result);
}The documentation is built with VitePress.
cd docs
npm install # Fetches Djot grammar from djot-intellij automatically
npm run docs:devThis starts a dev server at http://localhost:5173/djot-php/ with hot reload.
The Djot syntax highlighting grammar is fetched from djot-intellij during npm install (via postinstall hook), ensuring you always have the latest version.
cd docs
npm run docs:build
npm run docs:preview # Preview the build- Create a feature branch from
master - Write tests for new functionality
- Ensure all tests pass:
vendor/bin/phpunit --testsuite own - Ensure code style passes:
composer cs-check - Ensure PHPStan passes:
composer stan - Submit a pull request with a clear description
When reporting bugs, please include:
- PHP version
- Minimal djot input that reproduces the issue
- Expected output
- Actual output