| 1 | <div align="center"> |
| 2 | |
| 3 | # SimpleCSS |
| 4 | |
| 5 | **A simple [CSS 2.1](https://www.w3.org/TR/CSS21/) parser and selector.** |
| 6 | |
| 7 | [](https://xi.zulipchat.com/#narrow/channel/465085-resvg) |
| 8 | [](https://deps.rs/repo/github/linebender/simplecss) |
| 9 | [](#license) |
| 10 | [](https://github.com/linebender/simplecss/actions) |
| 11 | [](https://crates.io/crates/simplecss) |
| 12 | [](https://docs.rs/simplecss) |
| 13 |  |
| 14 | |
| 15 | </div> |
| 16 | |
| 17 | This is not a browser-grade CSS parser. |
| 18 | If you need one, use [cssparser](https://crates.io/crates/cssparser) + [selectors](https://crates.io/crates/selectors). |
| 19 | |
| 20 | Since it's very simple we will start with limitations: |
| 21 | |
| 22 | ## Limitations |
| 23 | |
| 24 | - [At-rules](https://www.w3.org/TR/CSS21/syndata.html#at-rules) are not supported. |
| 25 | They will be skipped during parsing. |
| 26 | - Property values are not parsed. |
| 27 | In CSS like `* { width: 5px }` you will get a `width` property with a `5px` value as a string. |
| 28 | - CDO/CDC comments are not supported. |
| 29 | - Parser is case sensitive. |
| 30 | All keywords must be lowercase. |
| 31 | - Unicode escape, like `\26`, is not supported. |
| 32 | |
| 33 | ## Features |
| 34 | |
| 35 | - Selector matching support. |
| 36 | - The rules are sorted by specificity. |
| 37 | - `!important` parsing support. |
| 38 | - Has a high-level parsers and low-level, zero-allocation tokenizers. |
| 39 | - No unsafe. |
| 40 | |
| 41 | ## Minimum supported Rust Version (MSRV) |
| 42 | |
| 43 | This version of SimpleCSS has been verified to compile with **Rust 1.65** and later. |
| 44 | |
| 45 | Future versions of SimpleCSS might increase the Rust version requirement. |
| 46 | It will not be treated as a breaking change and as such can even happen with small patch releases. |
| 47 | |
| 48 | <details> |
| 49 | <summary>Click here if compiling fails.</summary> |
| 50 | |
| 51 | As time has passed, some of SimpleCSS's dependencies could have released versions with a higher Rust requirement. |
| 52 | If you encounter a compilation issue due to a dependency and don't want to upgrade your Rust toolchain, then you could downgrade the dependency. |
| 53 | |
| 54 | ```sh |
| 55 | # Use the problematic dependency's name and version |
| 56 | cargo update -p package_name --precise 0.1.1 |
| 57 | ``` |
| 58 | </details> |
| 59 | |
| 60 | ## Community |
| 61 | |
| 62 | [](https://xi.zulipchat.com/#narrow/channel/465085-resvg) |
| 63 | |
| 64 | Discussion of SimpleCSS development happens in the Linebender Zulip at <https://xi.zulipchat.com/>, specifically the [#resvg channel](https://xi.zulipchat.com/#narrow/channel/465085-resvg). |
| 65 | All public content can be read without logging in. |
| 66 | |
| 67 | ## License |
| 68 | |
| 69 | Licensed under either of |
| 70 | |
| 71 | - Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or <http://www.apache.org/licenses/LICENSE-2.0>) |
| 72 | - MIT license ([LICENSE-MIT](LICENSE-MIT) or <http://opensource.org/licenses/MIT>) |
| 73 | |
| 74 | at your option. |
| 75 | |
| 76 | ## Contribution |
| 77 | |
| 78 | Contributions are welcome by pull request. The [Rust code of conduct] applies. |
| 79 | Please feel free to add your name to the [AUTHORS] file in any substantive pull request. |
| 80 | |
| 81 | Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be licensed as above, without any additional terms or conditions. |
| 82 | |
| 83 | [Rust Code of Conduct]: https://www.rust-lang.org/policies/code-of-conduct |
| 84 | [AUTHORS]: ./AUTHORS |