Skip to content

armgit / papra

Public Imported from GitHub
0

The minimalistic document archiving platform.

362 B
Raw Blame
export function escapeHtml(html: string) {
  return html.replace(/[&<>"']/g, (match) => {
    switch (match) {
      case '&':
        return '&amp;';
      case '<':
        return '&lt;';
      case '>':
        return '&gt;';
      case '"':
        return '&quot;';
      case "'":
        return '&#039;';
      default:
        return match;
    }
  });
}