Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/lazy_html.ex
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ defmodule LazyHTML do
"""
@spec html_escape(String.t()) :: String.t()
def html_escape(string) when is_binary(string) do
LazyHTML.Tree.append_escaped(string, "")
LazyHTML.Tree.html_escape(string)
end

# Access
Expand Down
8 changes: 6 additions & 2 deletions lib/lazy_html/tree.ex
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,9 @@ defmodule LazyHTML.Tree do
#
# [1]: https://github.com/phoenixframework/phoenix_html/blob/v4.2.1/lib/phoenix_html/engine.ex#L29-L35

@doc false
def append_escaped(text, html) do
# Note: it is important for this function to be private to maximise
# optimisation, see https://github.com/dashbitco/lazy_html/pull/18#issuecomment-3162730539.
defp append_escaped(text, html) do
append_escaped(text, text, 0, 0, html)
end

Expand Down Expand Up @@ -275,4 +276,7 @@ defmodule LazyHTML.Tree do

tree
end

@doc false
def html_escape(string), do: append_escaped(string, "")
end