MCPcopy Create free account
hub / github.com/REditorSupport/vscode-R / escapeHtml

Function escapeHtml

src/util.ts:440–450  ·  view source on GitHub ↗
(source: string)

Source from the content-addressed store, hash-verified

438
439// Helper function used to convert raw text files to html
440export function escapeHtml(source: string): string {
441 const entityMap = new Map<string, string>(Object.entries({
442 '&': '&amp;',
443 '<': '&lt;',
444 '>': '&gt;',
445 '"': '&quot;',
446 '\'': '&#39;',
447 '/': '&#x2F;'
448 }));
449 return String(source).replace(/[&<>"'/]/g, (s: string) => entityMap.get(s) || '');
450}
451
452// creates a directory if it doesn't exist,
453// returns the input string

Callers 2

getHtmlContentMethod · 0.90
pimpMyHelpFunction · 0.90

Calls 1

getMethod · 0.45

Tested by

no test coverage detected