🌴 Syntax highlighting in Rust.

Related tags

Command-line hl
Overview

🌴 HL (WIP)

Syntax highlighting written in Rust. The project is designed to generate html syntax highlighting for the given file.

This software is inspired by github syntax highlighter.

πŸš€ Usage

USAGE:
    hl [OPTIONS] [FILE_PATH] [SUBCOMMAND]

ARGS:
    <FILE_PATH>    File path to parse.

OPTIONS:
    -h, --help          Print help information
    -l <LANG>...        Language.
    -V, --version       Print version information

SUBCOMMANDS:
    -g, --generate, generate    Generate lexer, this is for development only.
    help                        Print this message or the help of the given subcommand(s)

πŸ’‘ Example Command

hl src/main.rs -l rust

πŸ’‘ Example Result

<table class="highlight-table">
<tbody>
<tr><td class="hl-num" data-line="1"></td><td><span class="hl-cmt">// The comment section</span></td></tr>
<tr><td class="hl-num" data-line="2"></td><td><span class="hl-k">fn</span> <span class="hl-en">main</span>() {</td></tr>
<tr><td class="hl-num" data-line="3"></td><td>    <span class="hl-k">let</span> matches = App::<span class="hl-en">new</span>(<span class="hl-c">"hl"</span>)</td></tr>
<tr><td class="hl-num" data-line="4"></td><td>        .<span class="hl-en">version</span>(<span class="hl-c">"0.1.0"</span>);</td></tr>
<tr><td class="hl-num" data-line="5"></td><td>    <span class="hl-k">let</span> ada = <span class="hl-c">5</span>;</td></tr>
<tr><td class="hl-num" data-line="6"></td><td>    <span class="hl-k">if</span> <span class="hl-c">true</span> {</td></tr>
<tr><td class="hl-num" data-line="7"></td><td>        <span class="hl-k">String</span>::<span class="hl-en">new</span>();</td></tr>
<tr><td class="hl-num" data-line="8"></td><td>        <span class="hl-k">let</span> a : <span class="hl-k">Vec</span><<span class="hl-k">char</span>> = <span class="hl-en">vec</span>!['0'];</td></tr>
<tr><td class="hl-num" data-line="9"></td><td>    }</td></tr>
<tr><td class="hl-num" data-line="10"></td><td>}</td></tr>
<tr><td class="hl-num" data-line="11"></td><td></td></tr>
<tr><td class="hl-num" data-line="12"></td><td><span class="hl-k">fn</span> <span class="hl-en">process</span>(a: &<span class="hl-k">str</span>, b: <span class="hl-k">char</span>) {</td></tr>
<tr><td class="hl-num" data-line="13"></td><td>    <span class="hl-en">println</span>!(a, b);</td></tr>
<tr><td class="hl-num" data-line="14"></td><td>}</td></tr>
<tr><td class="hl-num" data-line="15"></td><td></td></tr>
</tbody>
</table>

See the result in browser here.

Lexers

  • Bash ( βœ… Done )
  • C ( βœ… Done )
  • Clojure ( 🚧 In Progress )
  • CSS ( βœ… Done )
  • CPP ( βœ… Done )
  • C# ( 🚧 In Progress )
  • Go ( 🚧 In Progress )
  • HTML ( 🚧 In Progress )
  • Rust ( 🚧 In Progress )
  • Java ( βœ… Done )
  • Javascript ( 🚧 In Progress )
  • JSON ( βœ… Done )
  • Lua ( βœ… Done )
  • PHP ( βœ… Done )
  • Python ( 🚧 In Progress )
  • Typescript ( 🚧 In Progress )
  • Yaml ( βœ… Done )
You might also like...
Fast, minimal, feature-rich, extended formatting syntax for Rust!

Formatting Tools Fast, minimal, feature-rich, extended formatting syntax for Rust! Features include: Arbitrary expressions inside the formatting brace

Rust regex in ECMAScript regular expression syntax!

ecma_regex The goal of ecma_regex is to provide the same functionality as the regex crate in ECMAScript regular expression syntax. Reliable regex engi

Build Abstract Syntax Trees and tree-walking models quickly in Rust.

astmaker Build Abstract Syntax Trees and tree-walking models quickly in Rust. Example This example creates an AST for simple math expressions, and an

dwarf is a typed, interpreted, language that shares syntax with Rust.
dwarf is a typed, interpreted, language that shares syntax with Rust.

The dwarf Programming Language dwarf is a programming language based heavily upon, and implemented in, Rust. The language is interpreted (and slow) wi

Rust Server Components. JSX-like syntax and async out of the box.

RSCx - Rust Server Components RSCx is a server-side HTML rendering engine library with a neat developer experience and great performance. Features: al

A prolog like syntax for egg

egglog Using the egg library with a file format and semantics similar to datalog. Explanatory blog posts: https://www.philipzucker.com/egglog-checkpoi

Valq - macros for querying and extracting value from structured data by JavaScript-like syntax

valq   valq provides a macro for querying and extracting value from structured data in very concise manner, like the JavaScript syntax. Look & Feel: u

Shellharden is a syntax highlighter and a tool to semi-automate the rewriting of scripts to ShellCheck conformance, mainly focused on quoting
Shellharden is a syntax highlighter and a tool to semi-automate the rewriting of scripts to ShellCheck conformance, mainly focused on quoting

Shellharden is a syntax highlighter and a tool to semi-automate the rewriting of scripts to ShellCheck conformance, mainly focused on quoting

A superset of PHP with extended syntax and runtime capabilities.

PXP PXP is a superset of the PHP programming language that provides an extended set of syntax rules and language features to improve developer experie

Releases(v0.1.1)
Owner
ahmadrosid
Rust Developer
ahmadrosid
A syntax-highlighting pager for git, diff, and grep output

Get Started Install delta and add this to your ~/.gitconfig: [core] pager = delta [interactive] diffFilter = delta --color-only [delta]

Dan Davison 16k Dec 31, 2022
Simple calculator REPL, similar to bc(1), with syntax highlighting and persistent history

eva simple calculator REPL, similar to bc(1), with syntax highlighting and persistent history installation Homebrew $ brew install eva crates.io $ car

Akshay 632 Jan 4, 2023
A standalone code editor with syntax highlighting and themes.

CodeEditor A standalone code (and text) editor for people like me who write their own user interfaces utilizing crates like pixels. CodeEditor renders

Markus Moenig 8 Nov 25, 2022
🏭 Convert Markdown documents into themed HTML pages with support for code syntax highlighting, LaTeX and Mermaid diagrams.

Marky Markdown Magician ?? Features Hot reload previewing ?? Conversion to HTML / PDF ?? Themes! ✨ Extensions - Math, diagrams, syntax-highlighting ??

Vadim 12 Feb 19, 2023
🌈 A nushell plugin for syntax highlighting.

nu-plugin-highlight A nushell plugin for syntax highlighting. About nu-plugin-highlight is a plugin for Nushell that provides syntax highlighting for

Piepmatz 4 Jun 29, 2023
Count your code by tokens, types of syntax tree nodes, and patterns in the syntax tree. A tokei/scc/cloc alternative.

tcount (pronounced "tee-count") Count your code by tokens, types of syntax tree nodes, and patterns in the syntax tree. Quick Start Simply run tcount

Adam P. Regasz-Rethy 48 Dec 7, 2022
WIP. Goals: Treesitter highlighting, snippets, and a smooth intergration with neovim.

typst.nvim WIP. Goals: Tree-sitter highlighting, snippets, and a smooth integration with neovim. For the past week, I've been thinking what I want for

SeniorMars 66 Apr 9, 2023
Rust syntax in Turkish

pas pas (Turkish for Rust) allows to write Rust programs in Turkish, using Turkish keywords and function names, adapted from the original French imple

Barış Ekim 19 Dec 15, 2022
A syntax highlighter for Node powered by Tree Sitter. Written in Rust.

tree-sitter-highlight A syntax highlighter for Node.js powered by Tree Sitter. Written in Rust. Usage The following will output HTML: const treeSitter

Devon Govett 211 Dec 20, 2022
Notes on learning the Rust programming language syntax.

notes-on-rust Notes on learning the Rust programming language syntax. Resources https://www.rust-lang.org/learn/get-started https://doc.rust-lang.org/

Fred Snyder 1 Jan 2, 2022