glentities

Types

pub type EncodeMode {
  Named
  Hex
  HTMLBody
}

Constructors

  • Named

    Encode all characters that have a specified named entity using that name, except tab and newline.

  • Hex

    Encode all characters using hex entities, except a-z, A-Z, 0-9, newline, tab, carriage return, and space.

  • HTMLBody

    Encode only the necessary characters when the output target is HTML element or attribute content.

    This means &, <, >, ', and ".

    Note! Not suitable for outputting inside <style>, <script> elements.

Functions

pub fn decode(text: String) -> String

Decode any HTML entities in the given string.

pub fn encode(text: String, mode: EncodeMode) -> String

Encode characters in text as HTML entities with given encoding mode.

Search Document