From 44bb8fff155658bb80598149b3979b4bb224e05a Mon Sep 17 00:00:00 2001 From: GearsDatapacks Date: Fri, 22 Aug 2025 18:11:23 +0100 Subject: [PATCH] v2.0.0 --- CHANGELOG.md | 15 +++++++++++++++ README.md | 19 +++++++++---------- gleam.toml | 2 +- 3 files changed, 25 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index be0a97f..d19ba73 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,20 @@ # Changelog +## v2.0.0 - 2025-08-22 + +- Merged the `just/token` and `just/highlight` modules into one `just` module. + +- Renamed several variants and functions to prevent name clashes. + - `just/token.to_source` -> `just.token_to_source` + - `just.UnterminatedStringLiteral` -> `just.UnterminatedStringLiteral` + - `just.UnterminatedMultilineComment` -> `just.UnterminatedMultilineComment` + - `just.UnterminatedRegExpLiteral` -> `just.UnterminatedRegExpLiteral` + - `just.UnterminatedTemplateLiteral` -> `just.UnterminatedTemplateLiteral` + - `just/highlight.tokens` -> `just.highlight_tokens` + - `just/highlight.ansi` -> `just.highlight_ansi` + - `just/highlight.html` -> `just.highlight_html` + - `just/highlight.{type Token}` -> `just.HighlightToken` + ## v1.1.0 - 2025-04-02 - Updated the code for lexing Regular Expressions, Strings and Comments to use diff --git a/README.md b/README.md index 31c570a..814ec0c 100644 --- a/README.md +++ b/README.md @@ -5,19 +5,18 @@ A JavaScript lexer and syntax highlighter for Gleam! [![Package Version](https://img.shields.io/hexpm/v/just)](https://hex.pm/packages/just) [![Hex Docs](https://img.shields.io/badge/hex-docs-ffaff3)](https://hexdocs.pm/just/) -Just is a JavaScript lexer and syntax highlighter written in Gleam. -The `just` module, based on [`glexer`](https://hexdocs.mp/glexer) exposes a -standard lexer API, allowing you to convert JavaScript source code into tokens. -The `just/highlight` module allows you to highlight javascript code using ansi -colours, html or a custom format. Heavily inspired by [`contour`](https://hexdocs.pm/contour). +Just is a JavaScript lexer and syntax highlighter written in Gleam. The lexer is +based on [`glexer`](https://hexdocs.mp/glexer), allowing you to convert JavaScript +source code into tokens. There is also an API which allows you to highlight +JavaScript code using ansi colours, html or a custom format. Heavily inspired +by [`contour`](https://hexdocs.pm/contour). ```sh -gleam add just@1 +gleam add just@2 ``` ```gleam import just -import just/highlight pub fn main() { let code = "console.log('Hello, world!');" @@ -29,15 +28,15 @@ pub fn main() { parse_js(tokens) // Highlight with ansi codes to print in the terminal - let highlighted = highlight.ansi(code) + let highlighted = just.highlight_ansi(code) io.println(highlighted) // Render to html to show in the browser - let html = highlight.html(code) + let html = just.highlight_html(code) io.println("
" <> html <> "
") // Convert to "highlighting tokens" to highlight in some other way - let highlight_tokens = highlight.tokens(code) + let highlight_tokens = just.highlight_tokens(code) highlight_tokens_some_other_way(highlight_tokens) } ``` diff --git a/gleam.toml b/gleam.toml index 2112c9f..15ded3b 100644 --- a/gleam.toml +++ b/gleam.toml @@ -1,5 +1,5 @@ name = "just" -version = "1.1.0" +version = "2.0.0" description = "A JavaScript lexer and syntax highlighter for Gleam!" licences = ["Apache-2.0"] -- 2.51.2