djot
Parser and renderer for djot light markup syntax.
| LTS Haskell 24.60: | 0.1.4.2 |
| Stackage Nightly 2026-09-25: | 0.1.4.3 |
| Latest on Hackage: | 0.1.4.3 |
djot-0.1.4.3@sha256:fdb0952d5166cb6a6581d978b3deda732b79ec6974c189d189d54b8fd8b201a9,2728Module documentation for 0.1.4.3
Djot (https://djot.net) is a light markup language. This package provides a data structure to represent djot documents, a very fast parser, and functions to render a parsed document as HTML and as djot.
Changes
Revision history for djot
0.1.4.3 – 2026-09-23
-
Fix dropped attribute when attaching to last word of merged Strs. E.g. in
x y.z{.c}, the class was silently discarded. -
Fix implicit reference labels spanning multiple lines. Two bugs conspired to make
[link\ntext][]resolve to an empty href even when a “link text” reference was defined. -
Fix resumable attribute parser ignoring new input on resume. Previously a multiline block attribute followed by an indented block never finished parsing and the attributes were silently dropped, e.g.:
{#id .class style="color:red"} A paragraph -
Avoid quadratic inline parsing by caching chunk count. Previously parsing a paragraph was quadratic in the number of lines.
-
Speed up HTML escaping by copying unescaped runs wholesale.
-
Wrap letter list markers around after 26.
-
Fix off-by-one in tab column computation.
-
Propagate inline parse errors in
parseTextLinesinstead of crashing. -
Make NoPos an identity for
<>, so Monoid Pos is lawful. Previously NoPos was absorbing(NoPos <> p = NoPos), which would silently discard positions in any law-relying generic code (mconcat, fold). The only internal uses of<>on Pos (merging adjacent Strs) always combine two Pos or two NoPos values, so this does not change any parsing or rendering behavior. -
Fix UTF-8 truncation in
inlinesToByteString. -
Improve classification of autolinks. Previously
<[email protected]>was rendered as a plain URL link, not an email link. It’s an email link if it contains an ‘@’ preceded by a character other than ‘:’. -
Preserve soft breaks for CR-only line endings.
-
Add tests for whitespace collapsing in quoted attribute values.
-
Fix off-by-one in
pAtMost. -
Skip empty chunks when advancing to the next chunk.
-
Speed up djot rendering of Str inlines:
- Rewrite
escapeDjotto work directly on ByteStrings, copying runs of unescapable characters wholesale instead of processing character by character through String. (Equivalence with the old implementation checked with 100,000 QuickCheck cases.) - Skip the smart-punctuation replacement passes when the
ByteString contains no 0xE2 byte (the first byte of all the
UTF-8 sequences involved), avoiding five
T.replacetraversals per Str in the common case. - Avoid emitting an empty literal after each single-space chunk.
- Rewrite
0.1.4.2 – 2026-08-27
-
Djot renderer: emit raw blocks/inlines for formats other than djot (#18).
-
Djot renderer: Fix calculation of fence length. We needed to add one to the length of the biggest backtick string in the code.
-
Fix two bugs in footnote handling:
- Allow spaces and newlines in footnote references, as with djot.js.
- Don’t put a duplicate id on a second reference to same note.
0.1.4.1 – 2026-07-21
-
Fix bug in verbatim parsing (#17). We were wrongly allowing backslash escapes for backticks.
-
Fix resolution of reference links with newlines (#16).
0.1.4 – 2026-03-17
-
Ensure that delims aren’t matched in link destinations (#15).
-
Change behavior for empty link label. To match djot.js; we now take the string content (rather than raw source) of the link description, so e.g. emphasis is ignored.
-
Html renderer: don’t emit empty href for undefined ref link. This conforms to djot.js behavior, expected in tests.
-
Update links_and_images test from reference impl: djot.js.
0.1.3 – 2026-02-01
-
Fix nested sections bug when sections contain only lists (#14). When a section contained only list elements (no paragraphs), subsequent headings at the same level were incorrectly nested inside the previous section instead of being siblings.
-
CLI: add
--versionoption (#13). -
Export version from Djot module. [API change]
-
Remove some INLINE pragmas. These don’t make a measurable difference in benchmarks.
-
There can’t be a blank line btw block attrs and block. Cf. https://github.com/jgm/djot.js/issues/118
0.1.2.4 – 2025-11-30
-
Ensure that
'95--'96doesn’t get parsed as singlequoted. -
Properly handle bare
'}for right single-quote (#12).
0.1.2.3 – 2025-09-27
- Fix swallowing of indentation in code under blockquote (#11).
0.1.2.2 – 2024-10-04
-
Allow list items with blank lines between divs (#10).
-
Fix parsing of indented tables (#8).
0.1.2.1 – 2024-06-24
- Djot writer: include separator line in table when the table has non-default alignments but no header (#7).
0.1.2 – 2024-05-10
-
Allow
_in symbols (see jgm/djot#296). -
Add Lift derivations to AST datatypes (#5, Gideon Farrell) [API change].
0.1.1.3 – 2024-03-17
-
Ensure that tables end when we hit a blank line (#4).
-
Fix parsing of table immediately after list (#4).
0.1.1.2 – 2024-03-14
- Fix bug parsing regular paragraphs after list (#4).
0.1.1.1 – 2024-03-03
-
Revert “Djot.Blocks: use ByteString directly in
toIdentifier(#1)” This caused problems for UTF-8 sequences that contained the byte 0xa0, which B8.words treats as a space character. -
AST: avoid using B8.words in normalizeLabel.
-
Avoid using isSpace in attribute parsing. isSpace matches a byte 0x0a, which can break up a UTF-8 sequence. Limit to ASCII whitespace.
- Add test with UTF-8 identifier. See jgm/pandoc#9541.
0.1.1.0 – 2024-02-29
-
Add Data instances to everything in the AST [API change].
-
Ensure that block attributes are indented on subsequent lines (#2).
-
Djot.Blocks: use ByteString directly in
toIdentifier(#1, Vaibhav Sagar).
0.1.0.0 – 2024-02-14
- Initial release.