web-css-0.1.0: Simple functions for CSS.

Web.CSS.Escaping

Synopsis

Documentation

escapeIdentifier :: Text -> TextSource

Escape a CSS identifier. This function is slightly more permissive than the CSS standard. For example, it does not reject identifiers that begin with two hyphens. The function always escapes special characters such as the tilde (~) or left bracket ([). As such, they will never be interpreted as special characters.

escapeString :: Text -> TextSource

Escape a CSS string value. This function is conservative and produces only output characters in the US-ASCII range. This comes at the cost of space usage, so this function should not be used to encode strings expected to contain a disproportionate amount of non-US-ASCII characters.