cssparser

Rust implementation of CSS Syntax Level 3

Latest version: 0.35.0 registry icon
Maintenance score
78
Safety score
100
Popularity score
87
Check your open source dependency risks. Get immediate insight about security, stability and licensing risks.
Security
  Vulnerabilities
Version Suggest Low Medium High Critical
0.35.0 0 0 0 0 0
0.34.0 0 0 0 0 0
0.33.0 0 0 0 0 0
0.32.0 0 0 0 0 0
0.31.2 0 0 0 0 0
0.31.1 0 0 0 0 0
0.31.0 0 0 0 0 0
0.30.0 0 0 0 0 0
0.29.6 0 0 0 0 0
0.29.5 0 0 0 0 0
0.29.4 0 0 0 0 0
0.29.3 0 0 0 0 0
0.29.2 0 0 0 0 0
0.29.1 0 0 0 0 0
0.29.0 0 0 0 0 0
0.28.1 0 0 0 0 0
0.28.0 0 0 0 0 0
0.27.2 0 0 0 0 0
0.27.1 0 0 0 0 0
0.27.0 0 0 0 0 0
0.26.0 0 0 0 0 0
0.25.9 0 0 0 0 0
0.25.8 0 0 0 0 0
0.25.7 0 0 0 0 0
0.25.6 0 0 0 0 0
0.25.5 0 0 0 0 0
0.25.3 0 0 0 0 0
0.25.2 0 0 0 0 0
0.25.1 0 0 0 0 0
0.25.0 0 0 0 0 0
0.24.1 0 0 0 0 0
0.24.0 0 0 0 0 0
0.23.10 0 0 0 0 0
0.23.9 0 0 0 0 0
0.23.8 0 0 0 0 0
0.23.7 0 0 0 0 0
0.23.6 0 0 0 0 0
0.23.5 0 0 0 0 0
0.23.4 0 0 0 0 0
0.23.2 0 0 0 0 0
0.23.1 0 0 0 0 0
0.23.0 0 0 0 0 0
0.22.1 0 0 0 0 0
0.22.0 0 0 0 0 0
0.21.3 0 0 0 0 0
0.21.2 0 0 0 0 0
0.21.1 0 0 0 0 0
0.21.0 0 0 0 0 0
0.20.2 0 0 0 0 0
0.20.1 0 0 0 0 0
0.20.0 0 0 0 0 0
0.19.5 0 0 0 0 0
0.19.4 0 0 0 0 0
0.19.3 0 0 0 0 0
0.19.2 0 0 0 0 0
0.19.1 0 0 0 0 0
0.19.0 0 0 0 0 0
0.18.2 0 0 0 0 0
0.18.1 0 0 0 0 0
0.18.0 0 0 0 0 0
0.17.0 0 0 0 0 0
0.16.1 0 0 0 0 0
0.16.0 0 0 0 0 0
0.15.0 0 0 0 0 0
0.14.0 0 0 0 0 0
0.13.7 0 0 0 0 0
0.13.6 0 0 0 0 0
0.13.5 0 0 0 0 0
0.13.4 0 0 0 0 0
0.13.3 0 0 0 0 0
0.13.1 0 0 0 0 0
0.13.0 0 0 0 0 0
0.12.4 0 0 0 0 0
0.12.2 0 0 0 0 0
0.12.1 0 0 0 0 0
0.12.0 0 0 0 0 0
0.11.0 0 0 0 0 0
0.10.0 0 0 0 0 0
0.9.0 0 0 0 0 0
0.8.0 0 0 0 0 0
0.7.4 0 0 0 0 0
0.7.3 0 0 0 0 0
0.7.2 0 0 0 0 0
0.7.1 0 0 0 0 0
0.7.0 0 0 0 0 0
0.6.0 0 0 0 0 0
0.5.8 0 0 0 0 0
0.5.7 0 0 0 0 0
0.5.6 0 0 0 0 0
0.5.5 0 0 0 0 0
0.5.4 0 0 0 0 0
0.5.3 0 0 0 0 0
0.5.2 0 0 0 0 0
0.5.0 0 0 0 0 0
0.4.0 0 0 0 0 0
0.3.9 0 0 0 0 0
0.3.8 0 0 0 0 0
0.3.7 0 0 0 0 0
0.3.6 0 0 0 0 0
0.3.5 0 0 0 0 0
0.3.4 0 0 0 0 0
0.3.3 0 0 0 0 0
0.3.2 0 0 0 0 0
0.3.1 0 0 0 0 0
0.3.0 0 0 0 0 0
0.1.1 0 0 0 0 0
0.1.0 0 0 0 0 0

Stability
Latest release:

0.35.0 - This version is safe to use because it has no known security vulnerabilities at this time. Find out if your coding project uses this component and get notified of any reported security vulnerabilities with Meterian-X Open Source Security Platform

Licensing

Maintain your licence declarations and avoid unwanted licences to protect your IP the way you intended.

MPL-2.0   -   Mozilla Public License 2.0

Not a wildcard

Not proprietary

OSI Compliant



rust-cssparser

Build Status

Documentation

Rust implementation of CSS Syntax Module Level 3

Overview

Parsing CSS involves a series of steps:

  • When parsing from bytes, (e.g. reading a file or fetching an URL from the network,) detect the character encoding (based on a Content-Type HTTP header, an @charset rule, a BOM, etc.) and decode to Unicode text.

    rust-cssparser does not do this yet and just assumes UTF-8.

    This step is skipped when parsing from Unicode, e.g. in an HTML <style> element.

  • Tokenization, a.k.a. lexing. The input, a stream of Unicode text, is transformed into a stream of tokens. Tokenization never fails, although the output may contain error tokens.

  • This flat stream of tokens is then transformed into a tree of component values, which are either preserved tokens, or blocks/functions ({ … }, [ … ], ( … ), foo( … )) that contain more component values.

    rust-cssparser does this at the same time as tokenization: raw tokens are never materialized, you only get component values.

  • Component values can then be parsed into generic rules or declarations. The header and body of rules as well as the value of declarations are still just lists of component values at this point. See the Token enum for the data structure.

  • The last step of a full CSS parser is parsing the remaining component values into Selectors, specific CSS properties, etc.

    By design, rust-cssparser does not do this last step which depends a lot on what you want to do: which properties you want to support, what you want to do with selectors, etc.

    It does however provide some helper functions to parse CSS colors and An+B (the argument to :nth-child() and related selectors.

    See Servo’s style crate for an example of a parser based on rust-cssparser.