diff --git a/src/Markdig/Renderers/HtmlRenderer.cs b/src/Markdig/Renderers/HtmlRenderer.cs
index 27b5d361..085a4e97 100644
--- a/src/Markdig/Renderers/HtmlRenderer.cs
+++ b/src/Markdig/Renderers/HtmlRenderer.cs
@@ -144,6 +144,8 @@ public HtmlRenderer WriteEscape(string content, int offset, int length, bool sof
return this;
}
+ private static readonly SearchValues s_escapedChars = SearchValues.Create("<>&\"");
+
///
/// Writes the content escaped for HTML.
///
@@ -159,7 +161,7 @@ public void WriteEscape(ReadOnlySpan content, bool softEscape = false)
{
int indexOfCharToEscape = softEscape
? content.IndexOfAny('<', '&')
- : content.IndexOfAny("<>&\"");
+ : content.IndexOfAny(s_escapedChars);
if ((uint)indexOfCharToEscape >= (uint)content.Length)
{