leandrocp

leandrocp

Autumn is a syntax highlighter powered by Tree-sitter and Neovim themes.

You can check out how it looks like at https://autumnus.dev/

Features

  • :rocket: Backed by a Rust library
  • :deciduous_tree: 60+ languages
  • :artist_palette: 100+ Neovim themes
  • :memo: Formatters: html inline, html linked, terminal
  • :magnifying_glass_tilted_left: Language auto-detection

https://github.com/leandrocp/autumn

Showing Posts 1 to 8

Eiji

Eiji

It have even terminal formatter, amazing!

Can it detect if a call is a macro or function call? It would be amazing to style DSL and function call differently.

leandrocp

leandrocp OP

Hi @Eiji

I don’t think the Elixir parser does such distinction:

❯ cat example.ex
1 |> then(fn x -> x * 2 end)

❯ autumn dump-tree-sitter example.ex
source (0, 0) - (1, 0)
  binary_operator (0, 0) - (0, 28)
    integer (0, 0) - (0, 1) "1"
    |> (0, 2) - (0, 4) "|>"
    call (0, 5) - (0, 28)
      identifier (0, 5) - (0, 9) "then"
      arguments (0, 9) - (0, 28)
        ( (0, 9) - (0, 10) "("
        anonymous_function (0, 10) - (0, 27)
          fn (0, 10) - (0, 12) "fn"
          stab_clause (0, 13) - (0, 23)
            arguments (0, 13) - (0, 14)
              identifier (0, 13) - (0, 14) "x"
            -> (0, 15) - (0, 17) "->"
            body (0, 18) - (0, 23)
              binary_operator (0, 18) - (0, 23)
                identifier (0, 18) - (0, 19) "x"
                * (0, 20) - (0, 21) "*"
                integer (0, 22) - (0, 23) "2"
          end (0, 24) - (0, 27) "end"
        ) (0, 27) - (0, 28) ")"

So that then (macro call) is highlighted as function.call as defined in the query from nvim-treesitter:

❯ autumn highlight example.ex --formatter html-linked
<pre class="athl"><code class="language-elixir" translate="no" tabindex="0"><span class="line" data-line="1"><span class="number">1</span> <span class="operator">|&gt;</span> <span class="function-call">then</span><span class="punctuation-bracket">(</span><span class="keyword">fn</span> <span class="variable">x</span> <span class="operator">-&gt;</span> <span class="variable">x</span> <span class="operator">*</span> <span class="number">2</span> <span class="keyword">end</span><span class="punctuation-bracket">)</span>
</span></code></pre>
hauleth

hauleth

It is impossible to do with just parser, it would need to be full evaluator, especially that it requires to know about the called module.

leandrocp

leandrocp OP

Hey some updates for Autumn that might be worth checking out:

  • Added support to include a header element wrapping the code block
  • Added support to highlight specific lines using a CSS class or style (depends on the formatter)
  • Added more languages and a Random button on the demo site https://autumnus.dev
  • Functions to “bring your own theme” - you can edit themes and load at runtime
  • Added more than 10 new themes and updated a few more
  • Added new languages

Full changelog at Changelog — Autumn v0.7.0

josevalim

josevalim

Creator of Elixir

Really smart to use tree sitter for this. :slight_smile:

leandrocp

leandrocp OP

Hey Valim thanks! Indeed tree-sitter works very well with a relatively small binary and possibly even smaller thanks to feature flags :slight_smile:

Tree-sitter is pretty much becoming a standard and even vscode is exploring using it. Leaving this issue for those interested Explore using tree sitter for syntax highlighting · Issue #210475 · microsoft/vscode · GitHub

leandrocp

leandrocp OP

v0.5.0 released with a focus on highlighting lines, for example to highlight some lines with custom style:

{:html_inline, highlight_lines: %{lines: [1, 3..5, 8], style: "background-color: #fff3cd; border-left: 3px solid #ffc107;"}}

Also updated languages and themes, and replace <span> with <div> for lines. Full changelog at Changelog — Autumn v0.7.0

leandrocp

leandrocp OP

I should say that highlighted lines have default styles inherited from the CursorLine highlight group from Neovim themes, which is actually implemented by crates.io: Rust Package Registry

— All posts loaded —

Where Next? Top

Trending in Announcing Top

woylie
Flop is an Elixir library that applies filtering, ordering and pagination parameters to your Ecto queries. offset-based pagination with...
New
MRdotB
I needed to reuse React components from my Chrome extension in my Phoenix/LiveView backend. I noticed that for Svelte/Vue, there are live...
New
woylie
I released Doggo, a collection of unstyled Phoenix components. https://github.com/woylie/doggo Features Unstyled Phoenix components....
New
GenericJam
Edit: 2026 May 15 - This post is archived. Mob is alive!! Main docs: mob v0.7.11 — Documentation A bit of explanation for the slightly c...
New
JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
ahamez
Hi everyone, I’ve been working on this protobuf library for 3 years. We use it in the company I work for, EasyMile, to communicate with ...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
New
webofbits
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself. My main conc...
#ai
New
budgie
A little off-topic, but I feel like people here have a good head on their shoulders. I used to be quite good at making software. Was luc...
New
bartblast
Hey folks, I just published a post about Hologram’s funding and where the project goes next - the short version: Curiosum as Main Spons...
New
CodeSync
:microphone: ElixirConf 2026 - Call for Talks is open! We’re heading to Chicago :united_states: :round_pushpin: In person + virtual :d...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews