leandrocp / autumn Goto Github PK
View Code? Open in Web Editor NEWSyntax highlighter for source code parsed with Tree-Sitter and styled with Helix Editor themes.
Home Page: https://autumn-30n.pages.dev
License: MIT License
Syntax highlighter for source code parsed with Tree-Sitter and styled with Helix Editor themes.
Home Page: https://autumn-30n.pages.dev
License: MIT License
In case one wants to disable inline styles and style using classes instead.
Add support for all modifiers listed at https://docs.helix-editor.com/themes.html#modifiers
Ref
autumn/lib/autumn/themes_generator.ex
Line 213 in 93e8a35
For syntax highlight to work, it must load a language grammar that defines all scopes for each source code token that matches a class in the CSS theme file.
Currently we rely on Helix language definitions and themes which means we depend on Helix's project to maintain those files in order to generate the right colors at the end of the day.
For example the Elixir grammar defines a @namespace
scope even though the official grammar doesn't define such scope. That means all themes must consider that scope to highlight Elixir code properly, otherwise Autumn
fallbacks to the foreground color. For example the Dracula theme doesn't define that scope and will render a white text where you'd expect to see some color (module names), see https://autumn-30n.pages.dev/elixir_dracula
This approach saves a bunch of time but on the other hand brings the problem explained above. The fix to this problem could be:
While those fixes are doable, another approach is loading Zed languages and themes since those seems to be more updated and renders colors more accurately. The downside is that Zed doesn't support all languages we need at this moment, in special Swift that we use at https://dockyard.com/blog
To conclude, we would benefit having a mixed approach using Zed as the main source for languages/themes and fallback to Helix, until we can eventually drop Helix at all.
Support all underline styles listed at https://docs.helix-editor.com/themes.html#underline-style
Ref
autumn/lib/autumn/themes_generator.ex
Line 231 in 93e8a35
I noticed that lua doesn't seem to actually tokenize and render into anything.
example
┌─ 01:09:15 PM
│mitchell in 🌐 nublar in blog on main [?⇡] via v1.16.1 (OTP 26) took 36s
└─ iex
Erlang/OTP 26 [erts-14.2.2] [source] [64-bit] [smp:32:32] [ds:32:32:10] [async-threads:1] [jit:ns]
Interactive Elixir (1.16.1) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> Mix.install [:autumn]
Resolving Hex dependencies...
Resolution completed in 0.066s
New:
autumn 0.1.5
castore 1.0.6
rustler_precompiled 0.7.1
toml 0.7.0
* Getting autumn (Hex package)
* Getting rustler_precompiled (Hex package)
* Getting toml (Hex package)
* Getting castore (Hex package)
==> toml
Compiling 10 files (.ex)
Generated toml app
==> castore
Compiling 1 file (.ex)
Generated castore app
==> rustler_precompiled
Compiling 4 files (.ex)
Generated rustler_precompiled app
==> autumn
Compiling 5 files (.ex)
13:09:37.574 [debug] Downloading NIF from https://github.com/leandrocp/autumn/releases/download/v0.1.5/libinkjet_nif-v0.1.5-nif-2.15-x86_64-unknown-linux-gnu.so.tar.gz
13:09:38.365 [debug] NIF cached at /home/mitchell/.cache/rustler_precompiled/precompiled_nifs/libinkjet_nif-v0.1.5-nif-2.15-x86_64-unknown-linux-gnu.so.tar.gz and extracted to /home/mitchell/.cache/mix/installs/elixir-1.16.1-erts-14.2.2/0c46c564577fb109b3bf673cf29529d4/_build/dev/lib/autumn/priv/native/libinkjet_nif-v0.1.5-nif-2.15-x86_64-unknown-linux-gnu.so
Generated autumn app
:ok
iex(2)> Autumn.highlight!("lua", "os.foo({ foo = bar})", theme: "dracula") |> IO.puts()
<pre class="autumn highlight" style="background-color: #282A36; color: #f8f8f2;"><code class="language-lua" translate="no">os.foo({ foo = bar})</code></pre>
:ok
iex(3)>
not sure if this is an inket thing or an autumn thing tho.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.