this post was submitted on 10 Jun 2025
6 points (100.0% liked)

commandline

2024 readers
1 users here now

founded 2 years ago
MODERATORS
 

tjot is a terminal djot renderer.

Features

  • Covers 100% of the Djot spec
  • Reasonably fast:
    • pandoc -f djot -t ansi: 10 runs, milliseconds per run: [266, σ 270, 274]
    • tjot: 105 runs, milliseconds per run: [24, σ 26, 28]
  • ANSI glyphs & escape codes for nice tables, task lists, and coloring
  • Renders images, including SVGs
  • Detects the terminal size (usually) for accurate wrapping
  • Langage-sensitive highlighting for code blocks, and language detection

tjot is alpha; this is the first version that is useful. That said, it's fairly complete.

What is this?

djot is a markup language related to Markdown created by John MacFarlane, the author of pandoc. For a detailed explanation of why he invented djot, see this essay, but my interpretative summary is that he was unsatisfied with the complexity and size of CommonMark -- a result of trying to maintain compatability with Markdown -- and thought they could do better from scratch. djot was the result.

I've been using djot since late 2022, but as there (until recently) was no terminal pager for djot, I finally decided to write one.

To render djot documents on the command line, install tjot and call it with the path to a file, or pipe the file into tjot on stdin. Pipe the output to a pager such as less.

If the document references images via URL, those will be downloaded and rendered.

Limitations

  • There are known bugs; see the end of the CHANGELOG for a complete list
  • Ultimately, I want a pager. The current version only renders output; paging has to be provided by an external program
  • Customization is non-existent
  • While images are supported, rendering is via asci; there's no sixel, kitty, or other high-res rendering. SVG rendering, in particular, is of particularly questionable quality.

As usual, feedback is welcome, as are any reports of failures. Although this is an early release, the nature of the project is such that getting exposure to a wide variety and complexity of documents will help me improve it.

you are viewing a single comment's thread
view the rest of the comments
[–] ayushnix 2 points 1 week ago (3 children)

I don't see a link to tjot in your post.

[–] sxan@midwest.social 1 points 1 week ago (2 children)

Thank you; fixed.

It's always something.

[–] ayushnix 2 points 1 week ago (1 children)

Thanks! This tool should be helpful for previewing djot files.

I've wanted to use djot for blog posts but it doesn't look like there are any decent static site generators for it yet.

[–] sxan@midwest.social 2 points 1 week ago

Of course! Let me know when you find bad rendering.

Hugo said they wouldn't accept a PR. I'm converting to Markdown for Hugo, but it's lossy since Markdown doesn't support a few djot things I use, like pipe tables and CriticMarkup.

I've also asked Sourcehut if they (Drew) would accept a PR to support djot READMEs. I haven't seen a response from that ML yet. I know that's not a static site generator, but those are there two biggest places for me, outside of personal documents, where markup gets rendered for the web.

The other significant missing component for me after this pager is to integrate CriticMarkup into my VCS and SyncThing workflows. I want a better way of resolving diffs and sync-conflict files when they're on djot documents. tjot is part of that, and a djot diff tool that generates CriticMarkup is the other.