An open API service indexing awesome lists of open source software.

https://github.com/php-collective/wp-djot

Djot markup for WordPress – a modern, cleaner alternative to Markdown with syntax highlighting
https://github.com/php-collective/wp-djot

Last synced: about 1 month ago
JSON representation

Djot markup for WordPress – a modern, cleaner alternative to Markdown with syntax highlighting

Awesome Lists containing this project

README

          

# Djot Markup for WordPress

[![CI](https://github.com/php-collective/wp-djot/actions/workflows/ci.yml/badge.svg)](https://github.com/php-collective/wp-djot/actions/workflows/ci.yml)
[![WordPress Plugin Version](https://img.shields.io/wordpress/plugin/v/djot-markup)](https://wordpress.org/plugins/djot-markup/)
[![WordPress Plugin Downloads](https://img.shields.io/wordpress/plugin/dt/djot-markup)](https://wordpress.org/plugins/djot-markup/)
[![WordPress Plugin Rating](https://img.shields.io/wordpress/plugin/stars/djot-markup)](https://wordpress.org/plugins/djot-markup/)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
[![PHP 8.2+](https://img.shields.io/badge/PHP-8.2%2B-purple.svg)](https://php.net)
[![WordPress 6.0+](https://img.shields.io/badge/WordPress-6.0%2B-blue.svg)](https://wordpress.org)

A WordPress plugin for [Djot](https://djot.net/) markup language support.
Convert Djot syntax to HTML in posts, pages, and comments.

## What is Djot?

Djot is a light markup syntax created by John MacFarlane (creator of CommonMark and Pandoc). It aims to be a successor to Markdown with cleaner syntax and more consistent parsing rules.

[![Watch the demo video](https://img.youtube.com/vi/z0Nsjzp0gnw/mqdefault.jpg)](https://www.youtube.com/watch?v=z0Nsjzp0gnw)

## Features

- **Full Djot Support**: Headings, emphasis, links, images, code blocks, tables, footnotes, and more
- **Block Editor Support**: Native Gutenberg block for writing Djot with live preview
- **Shortcode Support**: Use `[djot]...[/djot]` in your content
- **Table of Contents**: Automatic TOC generation from headings with configurable levels and position
- **Heading Permalinks**: Clickable `#` symbols on headings (show on hover, copy URL to clipboard)
- **Content Profiles**: Configurable feature restrictions (full, article, comment, minimal)
- **Safe Mode**: XSS protection for untrusted content
- **Syntax Highlighting**: Server-side highlighting with Torchlight Engine
- **Code Block Enhancements**: Line numbers and line highlighting (VitePress-style syntax)
- **WP-CLI Migration**: Migrate existing HTML/Markdown content to Djot

## Example

````
# Welcome to My Blog

This is _emphasized_ and this is *strong*.

Here's a [link to Djot](https://djot.net/) and some `inline code`.

- First item
- Second item
- Third item

> A blockquote with some wisdom.

And a code block:

``` php
# Welcome to My Blog
>
> This is _emphasized_ and this is **strong**.
>
> Here's a [link to Djot](https://djot.net/) and some `inline code`.
>
> - First item
> - Second item
> - Third item
>
> > A blockquote with some wisdom.
>
> ```php
> echo "Hello, World!";
> ```

## Requirements

- PHP 8.2 or higher
- WordPress 6.0 or higher

## Installation

### From WordPress.org

Search for "Djot Markup" in the WordPress plugin directory, or visit:
[wordpress.org/plugins/djot-markup](https://wordpress.org/plugins/djot-markup/)

### From GitHub

```bash
cd wp-content/plugins
git clone https://github.com/php-collective/wp-djot.git
cd wp-djot
composer install --no-dev
```

## Documentation

- [Usage & Configuration](docs/README.md) - Getting started guide
- [Content Profiles](docs/profiles.md) - Configure feature restrictions
- [Customization](docs/customization.md) - Custom patterns, @mentions, render handlers
- [WP-CLI Commands](docs/wp-cli.md) - Migrate existing content
- [Hooks and Filters](docs/hooks.md) - Customize plugin behavior
- [Djot Syntax](docs/syntax.md) - Quick reference

For complete Djot syntax documentation, visit [djot.net](https://djot.net/).

## 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 playground](https://sandbox.dereuromark.de/sandbox/djot) - Live demo to check out how this markup language works.

## Credits

- [djot-php](https://github.com/php-collective/djot-php) by PHP Collective
- [Torchlight Engine](https://github.com/torchlight-api/engine) for syntax highlighting
- [djot-grammars](https://github.com/php-collective/djot-grammars) for Djot syntax highlighting in code blocks

## Changelog

See [CHANGELOG.md](CHANGELOG.md) for version history.