{"id":25533270,"url":"https://github.com/nucleus-labs/crest","last_synced_at":"2026-04-29T23:01:59.631Z","repository":{"id":259557671,"uuid":"866054751","full_name":"nucleus-labs/Crest","owner":"nucleus-labs","description":"A CSS library for parsing and applying styles to in-memory DOM structures.","archived":false,"fork":false,"pushed_at":"2025-02-08T22:58:35.000Z","size":265,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-20T05:50:48.127Z","etag":null,"topics":["css","css-parser","css-selectors","document-object-model","dom","lightweight","open-source","rust","rust-lang","selectors","styling","styling-css"],"latest_commit_sha":null,"homepage":"","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/nucleus-labs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/funding.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"MaxTheMooshroom"}},"created_at":"2024-10-01T15:12:51.000Z","updated_at":"2025-02-08T22:58:39.000Z","dependencies_parsed_at":"2024-10-26T14:09:09.336Z","dependency_job_id":"a8722473-62d6-410d-8769-ad2dd57a80f5","html_url":"https://github.com/nucleus-labs/Crest","commit_stats":null,"previous_names":["nucleus-labs/crest"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/nucleus-labs/Crest","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nucleus-labs%2FCrest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nucleus-labs%2FCrest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nucleus-labs%2FCrest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nucleus-labs%2FCrest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nucleus-labs","download_url":"https://codeload.github.com/nucleus-labs/Crest/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nucleus-labs%2FCrest/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32447312,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T22:27:22.272Z","status":"ssl_error","status_checked_at":"2026-04-29T22:10:49.234Z","response_time":110,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["css","css-parser","css-selectors","document-object-model","dom","lightweight","open-source","rust","rust-lang","selectors","styling","styling-css"],"created_at":"2025-02-20T02:18:39.344Z","updated_at":"2026-04-29T23:01:59.588Z","avatar_url":"https://github.com/nucleus-labs.png","language":"Rust","funding_links":["https://github.com/sponsors/MaxTheMooshroom"],"categories":[],"sub_categories":[],"readme":"# Crest\n\u003c!-- TODO: Add a banner image, icons for build results, status on crates.io, etc --\u003e\n\n# Overview\n\nCrest is a Rust library for working with CSS selectors and stylesheets. It provides tools to parse and validate\nCSS syntax, match selectors against custom DOM-like structures, and apply styles programmatically.\n\n## Status\n\nCrest is nearing alpha, and is able to parse any css style rules but unable to parse at-rules. It can also only\nvalidate a VERY limited subset of the standard style properties, and some [Peacock](#)-specific ones. It's already\nfairly fast, with planned changes to validation that should make it \u003cins\u003e***much***\u003c/ins\u003e faster.\n\n## Features\n\n- **CSS Parsing**: Parse and validate CSS strings, including selectors and stylesheets.\n- **Selector Matching**: Match parsed selectors against types implementing the `DomElement` trait.\n- **Custom DOM Support**: Easily integrate with your own DOM-like structures by implementing the `DomElement` trait.\n\n## Roadmap\n\n- [X] Expand benchmark coverage.\n- [ ] Document simple use cases.\n- [ ] Define the `DomElement` trait.\n- [ ] Add detailed examples for the `DomElement` trait.\n- [ ] Document advanced use cases.\n\n## Quickstart\n\n### Installation\n\nCrest is not yet available on [crates.io](https://crates.io/). To use it, include it as a dependency using a\ngit repository:\n\n```toml\n[dependencies]\npeacock-crest = { git = \"https://github.com/nucleus-labs/Crest/\", rev = \"\u003crev\u003e\" }\n```\n\n### Selector Parsing\n\nCrest uses [Pest](https://pest.rs/) to generate parsers for CSS selectors and for the full CSS syntax. Here's\nhow you can parse a selector string:\n\n```rust\nuse peacock_crest::{SourceInfo, SelectorNode};\n\nlet selector = \"div \u003e .example\";\nlet source_info = SourceInfo::new(selector);\nlet parsed_selector = SelectorNode::from_source(source_info).expect(\"Failed to read css\");\n\nprintln!(\"Parsed selector: {}\", parsed_selector);\n```\n\n### Stylesheet Parsing\n\nYou can also parse full CSS stylesheets:\n\n```rust\nuse peacock_crest::{SourceInfo, Stylesheet};\n\nlet css = \"div { color: red; } .example { font-size: 16px; }\";\nlet source_info = SourceInfo::new(css);\nlet stylesheet = Stylesheet::from_source(source_info).expect(\"Failed to read css\");\n\nprintln!(\"Parsed stylesheet:\\n{}\", stylesheet);\n```\n\n### Selector Matching\n\nTo match a selector against a custom element, implement the `DomElement` trait for your type:\n\n```rust\n// todo\n```\n\n## Testing and Validation\n\nCrest currently uses the following to validate Crest's functionality for historical reference and to\nensure compatibility with a range of CSS practices:\n- [X] acid1\n- [X] acid2\n- [ ] ~~bootstrap 1~~ (bootstrap2 relies on non-compliance with the standard and as such has been skipped in tests for historical compliance)\n- [ ] ~~bootstrap 2~~ (bootstrap2 relies on non-compliance with the standard and as such has been skipped in tests for historical compliance)\n- [ ] ~~bootstrap 3~~ (bootstrap2 relies on non-compliance with the standard and as such has been skipped in tests for historical compliance)\n- [ ] bootstrap 4\n- [ ] bootstrap 5\n\nTo run them, use:\n\n```bash\ncargo test\n```\n\n## Benchmarks\n\nPerformance benchmarks are available in the `benches` directory. To run them, use:\n\n```bash\ncargo bench\n```\n\nCurrent Results:\n\n\u003cimg src=\"assets/benchmarks.png\" alt=\"performance benchmarks between crest and other css parsers\" /\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnucleus-labs%2Fcrest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnucleus-labs%2Fcrest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnucleus-labs%2Fcrest/lists"}