PHPackages                             php-collective/djot - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. php-collective/djot

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

php-collective/djot
===================

A PHP parser for Djot, a modern light markup language

0.1.21(1mo ago)226.1k↓26.4%2[1 issues](https://github.com/php-collective/djot-php/issues)[3 PRs](https://github.com/php-collective/djot-php/pulls)6MITPHPPHP ^8.2CI passing

Since Nov 27Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/php-collective/djot-php)[ Packagist](https://packagist.org/packages/php-collective/djot)[ GitHub Sponsors](https://github.com/dereuromark)[ RSS](/packages/php-collective-djot/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (8)Versions (64)Used By (6)

Djot PHP
========

[](#djot-php)

[![CI](https://camo.githubusercontent.com/5989a08397cabe656b07355fd6b4d22ba63a823545db04aab96fee48676c787c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f7068702d636f6c6c6563746976652f646a6f742d7068702f63692e796d6c3f6272616e63683d6d6173746572267374796c653d666c61742d737175617265)](https://github.com/php-collective/djot-php/actions)[![Coverage](https://camo.githubusercontent.com/77eb9f1ca707e948de776751755861562cab0cc3a15d67d77011272227fa7947/68747470733a2f2f636f6465636f762e696f2f67682f7068702d636f6c6c6563746976652f646a6f742d7068702f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/php-collective/djot-php)[![Latest Stable Version](https://camo.githubusercontent.com/b58647242d39bdf68307e52f38b0b5cbe2e7067ffc03320ceb0eb1ee684b66a5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7068702d636f6c6c6563746976652f646a6f743f7374796c653d666c61742d737175617265)](https://packagist.org/packages/php-collective/djot)[![Total Downloads](https://camo.githubusercontent.com/3d766eab3692de2a0acbb39a81d6c7522276e040cc1991e5891264c61c7e8ce4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7068702d636f6c6c6563746976652f646a6f743f7374796c653d666c61742d737175617265)](https://packagist.org/packages/php-collective/djot)[![PHPStan](https://camo.githubusercontent.com/fa7d257d0c5c1cf237ac3490ef3a5561626b17fcb0a8547c01b0bb8746554e60/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d6c6576656c253230392d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](https://phpstan.org/)[![PHP Version](https://camo.githubusercontent.com/958da9c49ec5d3a994a485695225cd5ec57cc5b1e093b49892f65dd7ae8db3a9/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344382e322d3838393242462e7376673f7374796c653d666c61742d737175617265)](https://php.net)[![Software License](https://camo.githubusercontent.com/6c711032aff1ca0eb6b211aa6cb3649ce7fd64a7714e1181d4bb457f9680e7cf/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)

A PHP parser for [Djot](https://djot.net/), a modern light markup language created by John MacFarlane (author of CommonMark/Pandoc).

Installation
------------

[](#installation)

```
composer require php-collective/djot
```

Quick Start
-----------

[](#quick-start)

```
use Djot\DjotConverter;

$converter = new DjotConverter();
$html = $converter->convert('Hello *world*!');
// Output: Hello world!
```

Features
--------

[](#features)

- **Block elements**: Headings, paragraphs, code blocks, block quotes, lists, tables, divs, definition lists, line blocks
- **Inline elements**: Emphasis, strong, links, images, code, superscript, subscript, highlight, insert, delete
- **Advanced**: Footnotes, math expressions, symbols, block attributes, raw HTML blocks, comments
- **Smart typography**: Curly quotes, en/em dashes, ellipsis
- **Multiple renderers**: HTML, plain text, Markdown output
- **Extensions**: Built-in extensions for external links, TOC, heading permalinks, @mentions, autolinks, default attributes
- **Extensible**: Custom inline/block patterns, render events
- **File support**: Parse and convert files directly

Example
-------

[](#example)

```
use Djot\DjotConverter;
use Djot\Extension\ExternalLinksExtension;
use Djot\Extension\DefaultAttributesExtension;

$converter = new DjotConverter();

// Add extensions for common features
$converter
    ->addExtension(new ExternalLinksExtension())
    ->addExtension(new DefaultAttributesExtension([
        'table' => ['class' => 'table'],
    ]));

$djot = link.

NameRole

AliceDeveloper
BobDesigner

"Djot is a light markup syntax."

echo "Hello World";

```

Documentation
-------------

[](#documentation)

Full documentation is available at ****

- [Getting Started](https://php-collective.github.io/djot-php/guide/) - Installation and quick start
- [Why Djot?](https://php-collective.github.io/djot-php/guide/why-djot) - Comparison with Markdown
- [Syntax Reference](https://php-collective.github.io/djot-php/guide/syntax) - Complete Djot syntax guide
- [Extensions](https://php-collective.github.io/djot-php/extensions/) - Built-in extensions
- [API Reference](https://php-collective.github.io/djot-php/reference/api) - Classes and methods
- [Cookbook](https://php-collective.github.io/djot-php/cookbook/) - Customization recipes

Demo
----

[](#demo)

- [Interactive Playground](https://php-collective.github.io/djot-php/playground) - Try djot-php in your browser
- [Sandbox](https://sandbox.dereuromark.de/sandbox/djot) - Full-featured sandbox with all options

Security
--------

[](#security)

When processing untrusted user input, enable safe mode for XSS protection:

```
$converter = new DjotConverter(safeMode: true);
$html = $converter->convert($untrustedInput);
```

Safe mode automatically blocks dangerous URL schemes (`javascript:`, etc.), strips event handler attributes (`onclick`, etc.), and escapes raw HTML.

See [Safe Mode](https://php-collective.github.io/djot-php/guide/safe-mode) for details and advanced configuration.

Implementations
---------------

[](#implementations)

- [php-collective/wp-djot](https://github.com/php-collective/wp-djot) - WordPress plugin for Djot support
- [dereuromark/cakephp-markup](https://github.com/dereuromark/cakephp-markup) - CakePHP integration with Djot helper and view class

See Also
--------

[](#see-also)

- [Djot](https://djot.net/) - Official Djot website with syntax reference and playground
- [jgm/djot](https://github.com/jgm/djot) - Reference implementation in JavaScript by John MacFarlane
- [JetBrains IDE support](https://github.com/php-collective/djot-intellij) - Plugin for PhpStorm, IntelliJ IDEA, WebStorm, etc.
- [djot-grammars](https://github.com/php-collective/djot-grammars) - Syntax highlighting grammars (TextMate, highlight.js, Prism.js)

###  Health Score

51

—

FairBetter than 96% of packages

Maintenance89

Actively maintained with recent releases

Popularity35

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 97.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~5 days

Total

22

Last Release

52d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/39854?v=4)[Mark Scherer](/maintainers/dereuromark)[@dereuromark](https://github.com/dereuromark)

---

Top Contributors

[![dereuromark](https://avatars.githubusercontent.com/u/39854?v=4)](https://github.com/dereuromark "dereuromark (292 commits)")[![josbeir](https://avatars.githubusercontent.com/u/26058?v=4)](https://github.com/josbeir "josbeir (6 commits)")[![danielledeleo](https://avatars.githubusercontent.com/u/667598?v=4)](https://github.com/danielledeleo "danielledeleo (1 commits)")

---

Tags

djotlanguagemarkdownmarkdown-languagemarkupparsermarkdownmarkupdjot

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/php-collective-djot/health.svg)

```
[![Health](https://phpackages.com/badges/php-collective-djot/health.svg)](https://phpackages.com/packages/php-collective-djot)
```

###  Alternatives

[erusev/parsedown

Parser for Markdown.

15.0k151.8M732](/packages/erusev-parsedown)[league/commonmark

Highly-extensible PHP Markdown parser which fully supports the CommonMark spec and GitHub-Flavored Markdown (GFM)

3.0k404.0M702](/packages/league-commonmark)[erusev/parsedown-extra

An extension of Parsedown that adds support for Markdown Extra.

84314.8M192](/packages/erusev-parsedown-extra)[gregwar/rst

PHP library to parse reStructuredText documents

93499.3k13](/packages/gregwar-rst)[doctrine/rst-parser

PHP library to parse reStructuredText documents and generate HTML or LaTeX documents.

64233.6k9](/packages/doctrine-rst-parser)[parsedown/parsedown

Parser for Markdown.

21342.8k3](/packages/parsedown-parsedown)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
