cooklang / cooklang/cookcli

Editor: quantities inside {} are not highlighted

Open Beginner friendly
#495 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
1.4k
Forks
109
Avg merge
1d 22h
Merged PRs (30d)
19

Description

Found while reviewing the fix for #490.

`static/js/src/cooklang-mode.js` returns `"measurement"` for the quantity part of `{200%g}` (and `"unit"` only after `%`). `measurement` is not a Lezer highlight tag, so CodeMirror logs "Unknown highlighting tag measurement" and the number gets no class or colour; only the unit is styled.

Fix: map the quantity to a real tag (e.g. `t.number`) and give it a `.cm-cook-quantity` class in `static/css/input.css` on a token colour.

Contributor guide

Open the contributing guide

Research direction

Start in static/js/src/cooklang-mode.js and inspect how the quantity and unit parts of `{200%g}` are tagged, then check the editor for the reported highlighting warning. Update the quantity mapping and its styling in static/css/input.css; done means the quantity is coloured with a class and no unknown-tag warning is logged.

Written by the indexing model from the issue text.

Assessment

Tech stack
css, javascript
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
88/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.