package safehtml
import "github.com/a-h/templ/safehtml"
Index ¶
- Constants
- func SanitizeCSS(property, value string) (string, string)
- func SanitizeCSSProperty(property string) string
- func SanitizeCSSValue(property, value string) string
- func SanitizeStyleValue(s string) string
Constants ¶
const InnocuousPropertyName = "zTemplUnsafeCSSPropertyName"
InnocuousPropertyName is an innocuous property generated by a sanitizer when its input is unsafe.
const InnocuousPropertyValue = "zTemplUnsafeCSSPropertyValue"
InnocuousPropertyValue is an innocuous property generated by a sanitizer when its input is unsafe.
Functions ¶
func SanitizeCSS ¶
SanitizeCSS attempts to sanitize CSS properties.
func SanitizeCSSProperty ¶
func SanitizeCSSValue ¶
func SanitizeStyleValue ¶
SanitizeStyleValue escapes s so that it is safe to put between "" to form a CSS <string-token>. See syntax at https://www.w3.org/TR/css-syntax-3/#string-token-diagram.
On top of the escape sequences required in <string-token>, this function also escapes control runes to minimize the risk of these runes triggering browser-specific bugs. Taken from cssEscapeString in safehtml package.
Source Files ¶
- Version
- v0.3.906 (latest)
- Published
- Jun 25, 2025
- Platform
- linux/amd64
- Imports
- 5 packages
- Last checked
- 2 weeks ago –
Tools for package owners.