Current section
Files
Jump to
Current section
Files
src/glentities@html_encoder.erl
-module(glentities@html_encoder).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
-export([encode/1]).
-if(?OTP_RELEASE >= 27).
-define(MODULEDOC(Str), -moduledoc(Str)).
-define(DOC(Str), -doc(Str)).
-else.
-define(MODULEDOC(Str), -compile([])).
-define(DOC(Str), -compile([])).
-endif.
-file("src/glentities/html_encoder.gleam", 13).
?DOC(
" Encode text to be safe in the HTML body, inside element or attribute content.\n"
"\n"
" `&`, `<`, `>`, `'`, and `\"` are encoded.\n"
"\n"
" Note! Not suitable for outputting inside `<style>`, `<script>` elements.\n"
).
-spec encode(binary()) -> binary().
encode(Text) ->
glentities@internal@html_encoder@erl:escape(Text).