#syntax #highlighting #themes

bin+lib ultron-syntaxes-themes

Syntaxes and themes dump for ultron

8 releases

0.2.6 Oct 7, 2021
0.2.5 Sep 21, 2021
0.1.2 Sep 8, 2021

#16 in Text editors

Download history 35/week @ 2021-09-05 66/week @ 2021-09-12 30/week @ 2021-09-19 8/week @ 2021-09-26 30/week @ 2021-10-03 21/week @ 2021-10-10 2/week @ 2021-10-17

51 downloads per month
Used in 3 crates (via ultron)

MIT license

2MB
25K SLoC

Perl 5K SLoC // 0.1% comments D 2.5K SLoC // 0.1% comments Objective-C++ 2.5K SLoC // 0.1% comments C++ 2.5K SLoC // 0.1% comments Python 1.5K SLoC // 0.6% comments JavaScript 1.5K SLoC // 0.5% comments Java 1K SLoC // 0.5% comments Shell 1K SLoC // 0.5% comments C# 823 SLoC // 0.7% comments Ruby 679 SLoC // 0.5% comments Scala 623 SLoC // 0.6% comments Go 606 SLoC // 0.8% comments Erlang 589 SLoC // 0.9% comments Clojure 544 SLoC // 0.7% comments Objective-C 504 SLoC // 0.5% comments OCaml 486 SLoC // 0.2% comments Lua 459 SLoC // 0.6% comments Rust 445 SLoC // 0.6% comments C 335 SLoC // 0.6% comments PHP 325 SLoC // 0.8% comments ASP 291 SLoC // 0.7% comments Groovy 290 SLoC // 0.2% comments TCL 212 SLoC // 0.4% comments Batch 128 SLoC // 0.8% comments GNU Style Assembly 115 SLoC R 82 SLoC // 0.8% comments Lisp 52 SLoC // 0.7% comments Haskell 44 SLoC // 0.7% comments SQL 28 SLoC // 0.7% comments Ruby HTML 24 SLoC Pascal 9 SLoC // 0.6% comments

Ultron

Ultron is a web based monospace text-editor with syntax highlighting, completely written in rust.

Screenshot

Feature

  • Real monospace GUI with support for multi-width characters such as CJK and unicode box drawing.
  • Fast, typing latency at ~15ms and cursor move at ~10ms.
  • Block mode
    • Allows you to do a rectangular selection
  • Virtual edit
    • Allows you to type in anywhere on the editor, even on areas where there is no line

Syntax-highlighter for static site generator

Ultron comes with ultron-ssg crate which can be used for syntax highlighting for a static site generator.


use ultron_ssg;

fn main() {
    let content = r#"
        fn main(){
            println!("hello from ultron-ssg");
        }
    "#
    let html =
        ultron_ssg::render_to_string(content, "rust", Some("gruvbox-dark"));
    std::fs::create_dir_all("out").expect("must create dir");
    std::fs::write("out/hello.html", html).expect("must write to file");
}

Use-case

I wrote this code editor for my very specific usecase:

  • real monospace on GUI editors for ascii diagrams with support for multi-width characters such that it aligns with other characters on other lines with respect to their character width.

GUI editors don't handle monospace font quite well for CJK characters or any unicode characters that have are more than 1 character wide.

Terminal have no problem displaying them. Fonts in GUI seems to adjust characters on how closely they are lined up together. That is good for reading and all, but not for Ascii diagrams.

The solution would be to wrap each characters with a <div> to force them to be in one cell. Wide characters will be using <div class"wide_{n}"> where n is the unicode_width. The style for this char will then be set with a multiplier to the normal width.

Build and run the editor

git clone https://github.com/ivanceras/ultron.git

cd ultron
./serve.sh

Then, navigate to http://localhost:4002

Demo

link

Patreon link

Become a patron

Dependencies

~3.5–4.5MB
~84K SLoC