This package adds Djot markup language support to phpDocumentor's Guides library.
composer require phpdocumentor/guides-djot- PHP 8.2+
- php-collective/djot ^0.1.8
- phpdocumentor/guides ^1.0
Once installed, the package automatically registers Djot as a supported input format. You can then use .djot files in your documentation.
Create a file docs/index.djot:
# Welcome to My Project
This is documentation written in _Djot_ markup.
## Features
- *Strong* and _emphasis_ formatting
- {=Highlighted=} text
- Code blocks with syntax highlighting
```php
echo "Hello, World!";
See the official Djot spec for full syntax reference.
### Symfony Integration
If you're using Symfony, register the extension in your services:
```yaml
# config/services.yaml
services:
phpDocumentor\Guides\Djot\DependencyInjection\DjotExtension:
tags: ['kernel.extension']
Or load it programmatically:
use phpDocumentor\Guides\Djot\DependencyInjection\DjotExtension;
$extension = new DjotExtension();
$extension->load([], $containerBuilder);| Djot Feature | Guides Node |
|---|---|
| Headings | TitleNode |
| Paragraphs | ParagraphNode |
| Code blocks | CodeNode |
| Block quotes | QuoteNode |
| Lists (ordered/unordered) | ListNode |
| Task lists | ListNode with checkboxes |
| Tables | TableNode |
| Definition lists | DefinitionListNode |
| Thematic breaks | SeparatorNode |
| Images | ImageNode / FigureNode |
| Links | HyperLinkNode |
| Strong/Emphasis | StrongInlineNode / EmphasisInlineNode |
| Inline code | LiteralInlineNode |
| Highlight/Insert/Delete | GenericTextRoleInlineNode |
| Superscript/Subscript | GenericTextRoleInlineNode |
| Footnotes | FootnoteNode |
| Math | GenericTextRoleInlineNode |
| Raw blocks | RawNode |
| Divs | SectionNode |
Djot is a modern markup language created by John MacFarlane (author of Pandoc and CommonMark). It offers:
- Predictable parsing - No backtracking or context-dependent rules
- Built-in features - Highlights, insertions, deletions, attributes on any element
- Clear syntax -
_emphasis_vs*strong*(not ambiguous like Markdown) - Single specification - No "flavors" to worry about
See the djot-php documentation for more information.
MIT License - see LICENSE for details.