How to use the encode function from html-entities
Find comprehensive JavaScript html-entities.encode code examples handpicked from public code repositorys.
GitHub: jotaen/webshell.js
2 3 4 5 6 7 8 9 10 11 12
const entities = require('html-entities') const Autolinker = require('autolinker') const out = (input) => { return Autolinker.link( entities.encode(input), { newWindow: false, urls: { schemeMatches: true, wwwMatches: false, tldMatches: false }, phone: false,
5
18
3
GitHub: jotaen/webshell.js
39 40 41 42 43 44 45 46 47 48
currentHistoryItem = -1 const state = engine.state() const userName = stack.latest(state.sessions) const path = '/' + state.currentLocation.join('/') const html = [ '<span class="webshell-prompt-user">' + entities.encode(userName) + '</span>', '<span class="webshell-prompt-at">@</span>', '<span class="webshell-prompt-path">' + entities.encode(path) + '</span>', '<span class="webshell-prompt-delimiter">$</span>', '<span> </span>'
5
18
3
86 87 88 89 90 91 92 93 94 95
settingsFile[key] = value; if(key === 'customCss_input'){ settingsFile.customCss = escape.encode(uglifycss.processString(value)); } if(key === 'footerHtml_input'){ const footerHtml = typeof value !== 'undefined' || value === '' ? escape.encode(value) : ''; settingsFile.footerHtml = footerHtml; } if(key === 'googleAnalytics_input'){ const googleAnalytics = typeof value !== 'undefined' ? escape.encode(value) : '';
1
4
1
+ 5 other calls in file
46 47 48 49 50 51 52 53 54 55
return "<!DOCTYPE html><html lang=\"en\"><head>" + "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">" + "<meta charset=\"utf-8\">" + styles + "<title>" + encode(title) + "</title>" + faviconHtml + "</head>" + "<body class=\"no-js\">" + `<script type="text/javascript">` +
0
0
1
+ 2 other calls in file
26 27 28 29 30 31 32 33 34
const isActiveSubPage = isActive && j === currentPageIndexes[1]; return generateLiForPage(sp, isActiveSubPage); }).join(""); return `<li class="sidebar-item">` + `<div class="sidebar-item sidebar-item-group${isActive ? " active opened" : ""}">` + encode(p.displayName) + "</div>" + `<ul>${lis}</ul>` + "</li>";
0
0
1
+ 5 other calls in file
31 32 33 34 35 36 37 38 39 40
const cleanedHref = encode(relativeUri); return `<a class="navbar-item${activeClass}${customClass} hideable"` + `href="${cleanedHref}">${encode(l.displayName)}</a>`; } case "external-link": { const cleanedHref = encode(l.link); return `<a class="navbar-item${customClass} hideable"` + `href="${cleanedHref}">${encode(l.displayName)}</a>`; } case "github-link":
0
0
1
+ 8 other calls in file
352 353 354 355 356 357 358 359 360 361
var actLinks = createActLinksForRule(rule); rules.push([ `[${rule.id}](https://dequeuniversity.com/rules/axe/${axeVersion}/${rule.id}?application=RuleDescription)`, entities.encode(rule.metadata.description), impact, rule.tags.join(', '), issueType.join(', '), actLinks
0
0
1
+ 9 other calls in file
html-entities.decode is the most popular function in html-entities (166 examples)