highlightjs / highlight.js

JavaScript syntax highlighter with language auto-detection and zero dependencies.
https://highlightjs.org/
BSD 3-Clause "New" or "Revised" License
23.31k stars 3.52k forks source link

Adding union to be recognized as a keyword in Rust #3949

Closed Jaebaek-Lee closed 6 months ago

Jaebaek-Lee commented 6 months ago

Adding union to be recognized as a keyword in Rust.

https://github.com/highlightjs/highlight.js/issues/3948

Changes

Added the union keyword to the KEYWORDS array in rust.js. image

Checklist

github-actions[bot] commented 6 months ago

Build Size Report

Changes to minified artifacts in /build, after gzip compression.

3 files changed

Total change +4 B

View Changes | file | base | pr | diff | | --- | --- | --- | --- | | es/languages/rust.min.js | 1.48 KB | 1.49 KB | +3 B | | highlight.min.js | 8.21 KB | 8.21 KB | -1 B | | languages/rust.min.js | 1.49 KB | 1.49 KB | +2 B |
joshgoebel commented 6 months ago

Please also provide a test case of union used in context (outside of defining a union)... see tests/markup, etc.

Jaebaek-Lee commented 6 months ago

As I commented in the issue https://github.com/highlightjs/highlight.js/issues/3948, union is not commonly used except when defining unions, so I didn't write a separate test case for it. Of course, It can be used outside of defining a union, such as let r#union, but that's not relevant to this issue, as it's a case of the regex not recognizing union as a keyword.

joshgoebel commented 6 months ago

union is not commonly used except when defining unions, so I didn't write a separate test case for it.

Can you provide at least one sample usage outside of a union declaration other than r#union? The keywords list is not necessarily intended to be exhaustive if the keywords already have their own separate rules.

github-actions[bot] commented 6 months ago

Build Size Report

Changes to minified artifacts in /build, after gzip compression.

2 files changed

Total change +5 B

View Changes | file | base | pr | diff | | --- | --- | --- | --- | | es/languages/rust.min.js | 1.48 KB | 1.49 KB | +3 B | | languages/rust.min.js | 1.49 KB | 1.49 KB | +2 B |