Orderly

Orderly is an opinionated markdown formatter, striving to output beautiful markdown in most situations and be minimally configurable.

Similar to prettier for JavaScript or black for Python, Orderly saves time and allows you to focus your energy on the content.

Why use this instead or prettier

Good question! Orderly has certain advantages:

  • It is more opinionated:
    • It formats long links away from the body of the paragraph and prefers making extensive use of declarations at the end of the file, which are arguably more readable.
    • It renumbers all lists to make sure the numbers are sequential.
    • It adds more spacing to nested lists and block quotes, which might be annoying to some, but are arguably better formatted in certain edge cases.
  • It's faster (about 40x) and requires less memory (20x).
  • Does not require a working Javascript environment, it's a single binary distribution.

prettier has some other advantages:

  • It can format code within code-blocks (at least of JS).
  • Wider support for markdown features (definition lists, sub- and superscripts).

Use-cases

  • Run on save to autoformat your document.
  • Running on the CI to ensure the same formatting is applied to the entire project.

Orderly also strives to support common usa cases, such as GitHub flavoured markdown, frontmatter in Hugo & similar, mathematics, etc.

Example

Benchmark

In this simple benchmark, I compare the speed of prettier versus orderly. To do this, I run both tools in inplace editing mode for this large website:

Language Files Blank lines Code lines
Markdown 741 9 793 34 222

Results are:

Program Runtime Cumulative CPU time Peak memory Blank lines Code lines
prettier 3.41 s 8.08 s 172 MB 9 926 34 246
orderly 0.31 s 0.31 s 47 MB 9 985 36 727

Both programs are plenty fast so choose your favorite in terms of style.