MCPcopy Index your code
hub / github.com/rtfpessoa/diff2html / escapeForHtml

Function escapeForHtml

src/render-utils.ts:112–121  ·  view source on GitHub ↗
(str: string)

Source from the content-addressed store, hash-verified

110 */
111// TODO: Test this method inside deconstructLine since it should not be used anywhere else
112export function escapeForHtml(str: string): string {
113 return str
114 .slice(0)
115 .replace(/&/g, '&')
116 .replace(/</g, '&lt;')
117 .replace(/>/g, '&gt;')
118 .replace(/"/g, '&quot;')
119 .replace(/'/g, '&#x27;')
120 .replace(/\//g, '&#x2F;');
121}
122
123/**
124 * Deconstructs diff @line by separating the content from the prefix type

Callers 3

deconstructLineFunction · 0.85
diffHighlightFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…