Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/xevion/find-syntax
https://github.com/xevion/find-syntax
Last synced: 13 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/xevion/find-syntax
- Owner: Xevion
- Created: 2023-09-26T18:35:09.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2023-09-27T21:36:51.000Z (over 1 year ago)
- Last Synced: 2023-09-28T09:26:44.898Z (over 1 year ago)
- Language: Rust
- Size: 14.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# find-syntax
An experiment to try and find the ideal syntax highlighter for an arbitrary snippet.
- Given a snippet of code, query the GitHub Markdown API to generate highlighted HTML.
- Determine the complexity and level of color in the generated HTML.
- Report and display the results, showing the "best" syntax highlighter for the snippet.## Analysis
- Colorization can be counting the number of non-whitespace characters inside an element with a classname starting with `pl-` as a percentage of all non-whitespace characters.
- Some class identifiers represent white colors, and should be manually blacklisted from being counted.
- The deepest/closest classname should be used to determine the color.
- CSS analysis may be required if multiple classnames are used to determine the color. This shouldn't happen though.
- Complexity can be determined by analyzing the average coverage for each color within the colorized text.
- [Distribution calculation](https://gist.github.com/Xevion/1b5c971e88ac51521c133cc7e04ecdff)## Goals
- Memory caching of API results to prevent unnecessary requests.
- Automatic rate limiting and threading optimizations with Tokio, Governor, and Reqwest.
- GitHub Token & User-Agent compliance.
- Heuristics for determining the "best" syntax highlighter for per-request efficiency and overall speed.### Future
- Provide a server with a nice user intreface for viewing the results using GitHub's syntax.
- [Light] & [Dark] mode options.
- OAuth login to allow users to view their own private repos.
- Ability to select parts of the text that should have no color + some color to fine-tune the results.[light]: https://github.com/primer/github-syntax-light/blob/master/lib/github-light.css
[dark]: https://github.com/primer/github-syntax-dark/blob/master/lib/github-dark.css