Comments (4)
Sorry, I have no idea what this issue is asking for?
from chroma.
Are you suggesting using it for file extension detection, or something else?
I think the issue is that the mapping from Linguist file types to Chroma file types won't be 1:1
from chroma.
Take for example the json
lexer, Chroma only knows 2 filename
for it:
chroma/lexers/embedded/json.xml
Lines 5 to 6 in e9292e6
Linguist knows 17 extensions and 15 filenames:
This rich data from the linguist file could for example be extracted from the linguist file and written into chroma lexer's .xml
and .go
files so chroma ends up with much better filename-based language detection in lexers.Match
. But overall I think it might be better to just reduce and embed the linguist file in a build script that runs before each release.
Yes, it won't be a 1:1 mapping but the data extraction could be made best-effort where we map linguist name to chroma lexer name.
from chroma.
Not sure how you would feel about an additional dependency, but there is also https://github.com/go-enry/go-enry which offers various ways to detect a language based on filename or content (think bash scripts with no file extension). As far as I know, it is based on a somewhat-regularily updated dataset sourced from linguist. All that's left to do for chroma would be to map the detected language to a lexer.
from chroma.
Related Issues (20)
- CSS with nested styles doesnt hightlight the nested styles correctly
- Please can we have a new release? HOT 3
- LRU compiled style cache for the HTML formatter appears to break hugo HOT 6
- Please add Starlark (Bazel) lexer HOT 2
- C lexer treats #define as a comment HOT 1
- Add support for RenPy
- Add Gleam Lexer
- `lexers.DelegatingLexer` always does not highlight tokens correctly HOT 5
- New release? HOT 3
- Match Neovim's rose-pine-moon
- embedded: contains no embeddable files HOT 1
- Chroma Playground v2.9.1 is outdated compared to the latest release HOT 1
- Add support for bitbake language HOT 1
- Could you please support carbon
- Evergarden missing in compat.go HOT 1
- Scala 3 support
- Dot in a string breaks the highlighting in Terraform
- support linux syslog files
- Lexer for the Beef programming language HOT 1
- Add support for MikroTik/RouterOS scripts
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chroma.