Djot Explained

Djot
Extension:.dj[1]
Developer:John MacFarlane
Type:Lightweight markup language
Extended From:CommonMark
Free:Yes
Open:Yes

Djot (pronounced as //dʒɑt//) is a lightweight markup language that aims to improve on CommonMark's syntax where it is complex and difficult to parse efficiently.[2] It was created in 2022 by John MacFarlane, the author of Pandoc and a member of the CommonMark standardization group.[3] [4]

It derives most of its features from CommonMark, but includes a wider set of features, including description lists, footnotes, tables, several new kinds of inline formatting, math and smart punctuation.

The original reference implementation is written in a scripting language (Lua), but the language is designed to parse efficiently, so it is very fast.[5]

The code and documentation are released under the MIT License.[6]

Difference from CommonMark

Djot's syntax is similar to CommonMark's, but there are some differences.[7]

Blank lines

CommonMark does not need blank lines around block-level elements, but Djot does.

Example:

InputCorresponding HTML produced by a CommonMark processorCorresponding HTML produced by a Djot processor
  1. Heading

Paragraphs.

Heading

Paragraphs.

Heading Paragraphs.

  1. Heading

Paragraphs.

Heading

Paragraphs.

Heading

Paragraphs.

InputCorresponding HTML produced by a CommonMark processorCorresponding HTML produced by a Djot processor
  • fruits

* apple * banana

  • fruits
    • apple
    • banana
  • fruits * apple * banana
  • fruits

* apple * banana

  • fruits

    • apple
    • banana
  • fruits
    • apple
    • banana

Headings

Djot has no setext (= or -) headings, only ATX (#) headings.

Example:

Emphasis

CommonMark uses single * or _ for emphasis, and double * or _ for strong emphasis. Djot uses single _ for emphasis, and single * for strong emphasis.

Example:

Links

Unlike CommonMark, Djot has no special syntax for adding a title to a link. A title can be added by using the general attribute syntax instead.

Example:

Examples

Text using Djot syntaxCorresponding HTML produced by a Djot processorText viewed in a browser
  1. Heading
    1. Sub-heading

Paragraphs are separatedby a blank line.

The backslash at the end of a line\produces a line break.

Heading

Sub-heading

Paragraphs are separatedby a blank line.

The backslash at the end of a line
produces a line break.

Heading

Sub-heading

Paragraphs are separatedby a blank line.

The backslash at the end of a line
produces a line break.

Text attributes _italic_, *bold*, `monospace`.

Horizontal rule:

  • * *

Text attributes italic, bold, monospace.

Horizontal rule:


Text attributes italic, bold, monospace.

Horizontal rule:

----

Bullet lists nested within a numbered list:

1. fruits

* apple * banana

2. vegetables

- carrot - broccoli

Bullet lists nested within a numbered list:

  1. fruits
    • apple
    • banana
  2. vegetables
    • carrot
    • broccoli

Bullet lists nested within a numbered list:
  1. fruits
    • apple
    • banana
  2. vegetables
    • carrot
    • broccoli
A [link](http://example.com).[Image](Icon-pictures.png)

> Djot uses email-stylecharacters for blockquoting.>> Multiple paragraphs need to be prepended individually.

Raw content such as inline `HTML` tags must be explicitly marked.

A link.

Image

Djot uses email-style characters for blockquoting.

Multiple paragraphs need to be prepended individually.

Raw content such as inline HTML tags must be explicitly marked.

A link.

Djot uses email-style characters for blockquoting.

Multiple paragraphs need to be prepended individually.

Raw content such as inline HTML tags must be explicitly marked.

Implementations

Implementations of Djot
NameLicenseLanguageRepositoryDescription
djot.jsTypeScripthttps://github.com/jgm/djot.jsThis is a TypeScript rewrite of the original reference implementation.
djot.luaLuahttps://github.com/jgm/djot.luaThe original reference implementation.
JotdownRusthttps://github.com/hellux/jotdownPull parser implemented as a Rust library
DjotaProloghttps://github.com/aarroyoc/djotaImplementation in Prolog
djothsHaskellhttps://github.com/jgm/djothsHaskell library and command-line tool
godjotGohttps://github.com/sivukhin/godjotImplementation in Go

Uses

Notes and References

  1. Web site: File extension . 2023-01-24 . github.com . en.
  2. Web site: Djot (/dʒɑt/) . 2022-08-13 . djot.net . en.
  3. Web site: MacFarlane . John . 2022-07-11 . Initial commit . 2022-08-13 . github.com . en.
  4. Web site: MacFarlane . John . Tools . 2022-08-13 . johnmacfarlane.net . en.
  5. Web site: README.md . 2023-01-24 . github.com . en.
  6. Web site: License . 2022-08-13 . github.com . en.
  7. Web site: Quick Start for Markdown users . 2022-08-14 . github.com . en.
  8. Web site: pandoc 3.1.12 (2024-02-14) . 2024-03-05 . pandoc.org . en.