{"id":23376129,"url":"https://github.com/xevion/find-syntax","last_synced_at":"2025-08-04T20:05:23.973Z","repository":{"id":196940068,"uuid":"696948271","full_name":"Xevion/find-syntax","owner":"Xevion","description":null,"archived":false,"fork":false,"pushed_at":"2023-09-27T21:36:51.000Z","size":15,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-14T02:52:37.197Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Xevion.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-09-26T18:35:09.000Z","updated_at":"2023-09-26T23:17:19.000Z","dependencies_parsed_at":null,"dependency_job_id":"f16c4421-04b0-4955-9f1e-25be58887b97","html_url":"https://github.com/Xevion/find-syntax","commit_stats":null,"previous_names":["xevion/find-syntax"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Xevion%2Ffind-syntax","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Xevion%2Ffind-syntax/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Xevion%2Ffind-syntax/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Xevion%2Ffind-syntax/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Xevion","download_url":"https://codeload.github.com/Xevion/find-syntax/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247773744,"owners_count":20993633,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-21T17:33:47.985Z","updated_at":"2025-04-08T03:44:01.561Z","avatar_url":"https://github.com/Xevion.png","language":"Rust","readme":"# find-syntax\n\nAn experiment to try and find the ideal syntax highlighter for an arbitrary snippet.\n\n- Given a snippet of code, query the GitHub Markdown API to generate highlighted HTML.\n- Determine the complexity and level of color in the generated HTML.\n- Report and display the results, showing the \"best\" syntax highlighter for the snippet.\n\n## Analysis\n\n- 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.\n  - Some class identifiers represent white colors, and should be manually blacklisted from being counted.\n  - The deepest/closest classname should be used to determine the color.\n  - CSS analysis may be required if multiple classnames are used to determine the color. This shouldn't happen though.\n- Complexity can be determined by analyzing the average coverage for each color within the colorized text.\n    - [Distribution calculation](https://gist.github.com/Xevion/1b5c971e88ac51521c133cc7e04ecdff)\n\n## Goals\n\n- Memory caching of API results to prevent unnecessary requests.\n- Automatic rate limiting and threading optimizations with Tokio, Governor, and Reqwest.\n- GitHub Token \u0026 User-Agent compliance.\n- Heuristics for determining the \"best\" syntax highlighter for per-request efficiency and overall speed.\n\n### Future\n\n- Provide a server with a nice user intreface for viewing the results using GitHub's syntax.\n  - [Light] \u0026 [Dark] mode options.\n  - OAuth login to allow users to view their own private repos.\n- Ability to select parts of the text that should have no color + some color to fine-tune the results.\n\n[light]: https://github.com/primer/github-syntax-light/blob/master/lib/github-light.css\n[dark]: https://github.com/primer/github-syntax-dark/blob/master/lib/github-dark.css\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxevion%2Ffind-syntax","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxevion%2Ffind-syntax","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxevion%2Ffind-syntax/lists"}