Skip to content

Commit 368f3d3

Browse files
committed
feat: smalto 3.0.0
1 parent 630ea62 commit 368f3d3

10 files changed

Lines changed: 79 additions & 16 deletions

File tree

.github/workflows/smalto-lustre-themes.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ jobs:
2222
node-version: "24"
2323
- name: Use local smalto dependency
2424
run: |
25-
sed -i 's|smalto = ">= 2.0.0 and < 3.0.0"|smalto = { path = ".." }|' gleam.toml
26-
sed -i 's|smalto_lustre = ">= 2.0.0 and < 3.0.0"|smalto_lustre = { path = "../smalto_lustre" }|' gleam.toml
25+
sed -i 's|smalto = ">= 3.0.0 and < 4.0.0"|smalto = { path = ".." }|' gleam.toml
26+
sed -i 's|smalto_lustre = ">= 3.0.0 and < 4.0.0"|smalto_lustre = { path = "../smalto_lustre" }|' gleam.toml
2727
2828
- run: gleam deps download
2929
- run: gleam test

.github/workflows/smalto-lustre.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
with:
2222
node-version: "24"
2323
- name: Use local smalto dependency
24-
run: sed -i 's|smalto = ">= 2.0.0 and < 3.0.0"|smalto = { path = ".." }|' gleam.toml
24+
run: sed -i 's|smalto = ">= 3.0.0 and < 4.0.0"|smalto = { path = ".." }|' gleam.toml
2525

2626
- run: gleam deps download
2727
- run: gleam test

CHANGELOG.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,54 @@
11
# Changelog
22

3+
## 3.0.0
4+
5+
Released on 2026-03-17
6+
7+
### Added
8+
9+
- **theme_converter:** scaffold converter tool- **smalto_lustre_themes:** scaffold package- **theme_converter:** implement CSS theme parser and Gleam code generator- **smalto_lustre_themes:** generate 45 theme functions- **smalto_lustre_themes:** add Lustre HTML render example
10+
> Add dev/lustre_html_render.gleam that demonstrates using smalto_lustre_themes
11+
> to render syntax-highlighted source code to a standalone HTML file via Lustre
12+
> elements and element.to_document_string. Embeds the matching CSS theme for
13+
> base text color and background styling.- **tools:** add prism supported languages to fetcher- **languages:** generate grammar modules for new languages
14+
15+
### CI
16+
17+
- build theme_converter- smalto lustre themes workflow- gleam 1.15.0
18+
19+
### Documentation
20+
21+
- **smalto_lustre_themes:** add README- **smalto_lustre_themes:** add auto-generated notice and theme list to module docs- add smalto_lustre_themes to README and docs- update readme- CONTRIBUTING
22+
23+
### Fixed
24+
25+
- **theme_converter:** strip @media blocks, fix doc comments, add tests
26+
> Strip @media blocks before CSS parsing to prevent high-contrast
27+
> overrides (e.g. `color: highlight`) from leaking into token styles.
28+
> Skip asterisk separator comments in extractDescription and fall back
29+
> to filename-derived descriptions for themes without doc comments.
30+
>
31+
> Extract converter logic into src/converter.js for testability and add
32+
> 49 unit tests covering all exported functions.- restore registry, update docs and examples for new languages
33+
> The prism_converter tool was overwriting the registry with only the
34+
> languages converted in each run. Fix the tool to always include all
35+
> known languages in the registry. Regenerate the registry with all 36
36+
> languages, update language counts and tables in README, docs, and
37+
> smalto.gleam module doc. Add extension mappings for the 6 new languages
38+
> (C#, F#, Nginx, Razor, React JSX, React TSX) to dev/cat.gleam.- escape lone curly braces in JS regex compilation
39+
> JS unicode mode (`u` flag) requires `{` and `}` to be escaped when not
40+
> part of valid quantifiers, unlike PCRE which treats them as literals.
41+
> This caused C#/Razor grammar regexes (e.g. `with(?=\s*{)`) to silently
42+
> fail to compile on the JS target, dropping keyword and class-name rules.
43+
44+
### Miscellaneous
45+
46+
- smalto lustre themes v 2
47+
48+
### Testing
49+
50+
- **smalto_lustre_themes:** add theme rendering tests- **languages:** add C# syntax highlighting snapshot- **languages:** add F# syntax highlighting snapshot- **languages:** add Nginx syntax highlighting snapshot- **languages:** add React JSX syntax highlighting snapshot- **languages:** add React TSX syntax highlighting snapshot- **languages:** add Razor syntax highlighting snapshot- fixed test for prism tool
51+
352
## 2.0.2
453

554
Released on 2026-03-16

CONTRIBUTING.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,8 @@ When adding a new language, make sure all of these files are updated:
197197
- [ ] `test/languages_test.gleam` - snapshot test
198198
- [ ] `birdie_snapshots/<lang>_highlighting.accepted` - accepted snapshot
199199
- [ ] `dev/cat.gleam` - extension mapping
200+
- [ ] `dev/html_render.gleam` - extension mapping
201+
- [ ] `smalto_lustre_themes/dev/lustre_html_render.gleam` - extension mapping
200202
- [ ] `src/smalto.gleam` - language count in module doc
201203
- [ ] `docs/supported-languages.md` - count and table row
202204
- [ ] `docs/index.md` - language count

gleam.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name = "smalto"
2-
version = "2.0.2"
2+
version = "3.0.0"
33
description = "A general-purpose syntax highlighting library for Gleam, with regex-based grammars for 30 languages."
44
repository = { type = "github", user = "veeso", repo = "smalto" }
55
licenses = ["MIT"]

smalto_lustre/gleam.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name = "smalto_lustre"
2-
version = "2.0.0"
2+
version = "3.0.0"
33
description = "Syntax highlighting to Lustre element conversion"
44
repository = { type = "github", user = "veeso", repo = "smalto" }
55
licenses = ["MIT"]
@@ -8,7 +8,7 @@ links = [{ title = "Codeberg", href = "https://codeberg.org/veeso/smalto" }]
88

99
[dependencies]
1010
gleam_stdlib = ">= 0.44.0 and < 2.0.0"
11-
smalto = ">= 2.0.0 and < 3.0.0"
11+
smalto = ">= 3.0.0 and < 4.0.0"
1212
lustre = ">= 5.4.0 and < 6.0.0"
1313

1414
[dev-dependencies]

smalto_lustre/manifest.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ packages = [
1212
{ name = "gleeunit", version = "1.9.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleeunit", source = "hex", outer_checksum = "DA9553CE58B67924B3C631F96FE3370C49EB6D6DC6B384EC4862CC4AAA718F3C" },
1313
{ name = "houdini", version = "1.2.0", build_tools = ["gleam"], requirements = [], otp_app = "houdini", source = "hex", outer_checksum = "5DB1053F1AF828049C2B206D4403C18970ABEF5C18671CA3C2D2ED0DD64F6385" },
1414
{ name = "lustre", version = "5.6.0", build_tools = ["gleam"], requirements = ["gleam_erlang", "gleam_json", "gleam_otp", "gleam_stdlib", "houdini"], otp_app = "lustre", source = "hex", outer_checksum = "EE558CD4DB9F09FCC16417ADF0183A3C2DAC3E4B21ED3AC0CAE859792AB810CA" },
15-
{ name = "smalto", version = "2.0.0", build_tools = ["gleam"], requirements = ["gleam_community_ansi", "gleam_stdlib", "houdini"], otp_app = "smalto", source = "hex", outer_checksum = "9B2E4CAE09356CEFCD5239A60E4F494D92DB79271469B02C8D03109000976D92" },
15+
{ name = "smalto", version = "3.0.0", build_tools = ["gleam"], requirements = ["gleam_community_ansi", "gleam_stdlib", "houdini"], otp_app = "smalto", source = "hex", outer_checksum = "13EA8935A9E60A770E326FB850F5A5B3612A62E0A6C62C3F850AD04C842E3769" },
1616
]
1717

1818
[requirements]
1919
gleam_stdlib = { version = ">= 0.44.0 and < 2.0.0" }
2020
gleeunit = { version = ">= 1.0.0 and < 2.0.0" }
2121
lustre = { version = ">= 5.4.0 and < 6.0.0" }
22-
smalto = { version = ">= 2.0.0 and < 3.0.0" }
22+
smalto = { version = ">= 3.0.0 and < 4.0.0" }

smalto_lustre_themes/dev/lustre_html_render.gleam

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,13 @@ import smalto/grammar.{type Grammar}
2727
import smalto/languages/bash
2828
import smalto/languages/c
2929
import smalto/languages/cpp
30+
import smalto/languages/csharp
3031
import smalto/languages/css
3132
import smalto/languages/dart
3233
import smalto/languages/dockerfile
3334
import smalto/languages/elixir
3435
import smalto/languages/erlang
36+
import smalto/languages/fsharp
3537
import smalto/languages/gleam
3638
import smalto/languages/go
3739
import smalto/languages/haskell
@@ -42,8 +44,12 @@ import smalto/languages/json
4244
import smalto/languages/kotlin
4345
import smalto/languages/lua
4446
import smalto/languages/markdown
47+
import smalto/languages/nginx
4548
import smalto/languages/php
4649
import smalto/languages/python
50+
import smalto/languages/razor
51+
import smalto/languages/reactjsx
52+
import smalto/languages/reacttsx
4753
import smalto/languages/ruby
4854
import smalto/languages/rust
4955
import smalto/languages/scala
@@ -236,14 +242,19 @@ fn extension_map() -> dict.Dict(String, Grammar) {
236242
#("c", c.grammar()),
237243
#("cc", cpp.grammar()),
238244
#("cjs", javascript.grammar()),
245+
#("conf", nginx.grammar()),
239246
#("cpp", cpp.grammar()),
247+
#("cs", csharp.grammar()),
248+
#("cshtml", razor.grammar()),
240249
#("css", css.grammar()),
241250
#("cxx", cpp.grammar()),
242251
#("dart", dart.grammar()),
243252
#("dockerfile", dockerfile.grammar()),
244253
#("erl", erlang.grammar()),
245254
#("ex", elixir.grammar()),
246255
#("exs", elixir.grammar()),
256+
#("fs", fsharp.grammar()),
257+
#("fsx", fsharp.grammar()),
247258
#("gleam", gleam.grammar()),
248259
#("go", go.grammar()),
249260
#("h", c.grammar()),
@@ -255,6 +266,7 @@ fn extension_map() -> dict.Dict(String, Grammar) {
255266
#("java", java.grammar()),
256267
#("js", javascript.grammar()),
257268
#("json", json.grammar()),
269+
#("jsx", reactjsx.grammar()),
258270
#("kt", kotlin.grammar()),
259271
#("kts", kotlin.grammar()),
260272
#("lua", lua.grammar()),
@@ -273,7 +285,7 @@ fn extension_map() -> dict.Dict(String, Grammar) {
273285
#("swift", swift.grammar()),
274286
#("toml", toml.grammar()),
275287
#("ts", typescript.grammar()),
276-
#("tsx", typescript.grammar()),
288+
#("tsx", reacttsx.grammar()),
277289
#("xml", xml.grammar()),
278290
#("yaml", yaml.grammar()),
279291
#("yml", yaml.grammar()),

smalto_lustre_themes/gleam.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
name = "smalto_lustre_themes"
2-
version = "2.0.0"
2+
version = "3.0.0"
33
description = "Pre-built theme configurations for smalto_lustre syntax highlighting"
44
repository = { type = "github", user = "veeso", repo = "smalto" }
55
licenses = ["MIT"]
66
links = [{ title = "Codeberg", href = "https://codeberg.org/veeso/smalto" }]
77

88
[dependencies]
99
gleam_stdlib = ">= 0.44.0 and < 2.0.0"
10-
smalto_lustre = ">= 2.0.0 and < 3.0.0"
10+
smalto_lustre = ">= 3.0.0 and < 4.0.0"
1111
lustre = ">= 5.4.0 and < 6.0.0"
1212

1313
[dev-dependencies]
1414
argv = ">= 1.0.2 and < 2.0.0"
1515
gleeunit = ">= 1.0.0 and < 2.0.0"
1616
simplifile = ">= 2.4.0 and < 3.0.0"
17-
smalto = ">= 2.0.0 and < 3.0.0"
17+
smalto = ">= 3.0.0 and < 4.0.0"

smalto_lustre_themes/manifest.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ packages = [
1515
{ name = "houdini", version = "1.2.0", build_tools = ["gleam"], requirements = [], otp_app = "houdini", source = "hex", outer_checksum = "5DB1053F1AF828049C2B206D4403C18970ABEF5C18671CA3C2D2ED0DD64F6385" },
1616
{ name = "lustre", version = "5.6.0", build_tools = ["gleam"], requirements = ["gleam_erlang", "gleam_json", "gleam_otp", "gleam_stdlib", "houdini"], otp_app = "lustre", source = "hex", outer_checksum = "EE558CD4DB9F09FCC16417ADF0183A3C2DAC3E4B21ED3AC0CAE859792AB810CA" },
1717
{ name = "simplifile", version = "2.4.0", build_tools = ["gleam"], requirements = ["filepath", "gleam_stdlib"], otp_app = "simplifile", source = "hex", outer_checksum = "7C18AFA4FED0B4CE1FA5B0B4BAC1FA1744427054EA993565F6F3F82E5453170D" },
18-
{ name = "smalto", version = "2.0.2", build_tools = ["gleam"], requirements = ["gleam_community_ansi", "gleam_stdlib", "houdini"], otp_app = "smalto", source = "hex", outer_checksum = "199C1A010F4CEE6E4DBE17C74A3F42326A1C89956C0D884B2BCC611104185CD1" },
19-
{ name = "smalto_lustre", version = "2.0.0", build_tools = ["gleam"], requirements = ["gleam_stdlib", "lustre", "smalto"], otp_app = "smalto_lustre", source = "hex", outer_checksum = "7C00BDC91CCE90240F4746E7BA250DC725D0D05D7B17B6B622DEEF921F78196D" },
18+
{ name = "smalto", version = "3.0.0", build_tools = ["gleam"], requirements = ["gleam_community_ansi", "gleam_stdlib", "houdini"], otp_app = "smalto", source = "hex", outer_checksum = "13EA8935A9E60A770E326FB850F5A5B3612A62E0A6C62C3F850AD04C842E3769" },
19+
{ name = "smalto_lustre", version = "3.0.0", build_tools = ["gleam"], requirements = ["gleam_stdlib", "lustre", "smalto"], otp_app = "smalto_lustre", source = "hex", outer_checksum = "63C5F2CE886D7CDFEAABAAC5A0E7B3EDBF69F9776A08AACA0360B0948745EF2A" },
2020
]
2121

2222
[requirements]
@@ -25,5 +25,5 @@ gleam_stdlib = { version = ">= 0.44.0 and < 2.0.0" }
2525
gleeunit = { version = ">= 1.0.0 and < 2.0.0" }
2626
lustre = { version = ">= 5.4.0 and < 6.0.0" }
2727
simplifile = { version = ">= 2.4.0 and < 3.0.0" }
28-
smalto = { version = ">= 2.0.0 and < 3.0.0" }
29-
smalto_lustre = { version = ">= 2.0.0 and < 3.0.0" }
28+
smalto = { version = ">= 3.0.0 and < 4.0.0" }
29+
smalto_lustre = { version = ">= 3.0.0 and < 4.0.0" }

0 commit comments

Comments
 (0)