How to use escape-html - 10 common examples

To help you get started, we’ve selected a few escape-html examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github callstack / linaria / website / src / App.js View on Github external
const header = css\`
                  color: $\{colors.white};

                  [data-theme=dark] & {
                    color: $\{colors.black}
                  }

                  @media (max-width: 320px) {
                    font-size: 2rem;
                  }
                \`;

                export default function Header({ className }) {
                  return (
                    ${escapeHtml(`<div>
                      <h1>
                    </h1></div>`)}
                  );
                }`)}
            /&gt;
          
          <div>
            </div>
github wladich / nakarte / src / lib / leaflet.control.track-list / lib / geo_file_exporters.js View on Github external
function saveKml(segments, name, points) {
    const kml = [];

    name = name || 'Track';
    name = escapeHtml(name);
    name = utf8.encode(name);

    kml.push('');
    kml.push('');
    kml.push('\t');
    kml.push(`\t\t${name}`);

    const normalizedSegments = normalizeLines(segments);
    for (let [i, segment] of normalizedSegments.entries()) {
        kml.push('\t\t');
        kml.push(`\t\t\tLine ${(i + 1)}`);
        kml.push('\t\t\t');
        kml.push('\t\t\t\t1');
        kml.push('\t\t\t\t');

        for (let point of segment) {
github SonarSource / sonarqube / server / sonar-web / src / main / js / apps / users / groups-view.js View on Github external
dangerouslyUnescapedHtmlFormat(item) {
        return (
          `${escapeHtml(item.name)}<br>` +
          `<span class="note">${escapeHtml(item.description)}</span>`
        );
      },
      queryParam: 'q',
github rsimmons / voracious / src / components / HighlightSet.js View on Github external
        (c, i) =&gt; (c === '\n' ? '<br>' : escape(c))
      ).join('');
github steelbrain / busy-signal / lib / element.js View on Github external
tooltipMessage.push('<strong>History:</strong>', history.map(function(item) {
        return `${escape(item.title)} (${item.duration})`
      }).join('<br>'))
    }
github expo / snack-web / src / client / components / Markdown / MarkdownPreview.tsx View on Github external
highlight: (code, lang) => {
        const grammar = lang === 'js' ? languages.jsx : languages[lang];
        return grammar ? highlight(code, grammar) : escape(code);
      },
    });
github tjscollins / axe-crawler / src / output.js View on Github external
all.forEach(({ message }) =&gt; {
      list += `<br>${escape(message)}`;
    });
    none.forEach(({ message }) =&gt; {
github solid / solid-ui / src / widgets / peoplePicker.js View on Github external
render () {
    const container = document.createElement('div')
    container.style.maxWidth = '350px'
    container.style.minHeight = '200px'
    container.style.outline = '1px solid black'
    container.style.display = 'flex'

    if (this.selectedgroup) {
      container.style.flexDirection = 'column'
      const selectedGroup = document.createElement('div')
      new Group(selectedGroup, this.selectedgroup).render()
      const changeGroupButton = document.createElement('button')
      changeGroupButton.textContent = escape('Change group')
      changeGroupButton.addEventListener('click', _event => {
        this.selectedgroup = null
        this.render()
      })
      container.appendChild(selectedGroup)
      container.appendChild(changeGroupButton)
    } else {
      this.findAddressBook(this.typeIndex)
        .then(({ book }) => {
          const chooseExistingGroupButton = document.createElement('button')
          chooseExistingGroupButton.textContent = escape(
            'Pick an existing group'
          )
          chooseExistingGroupButton.style.margin = 'auto'
          chooseExistingGroupButton.addEventListener('click', _event => {
            new GroupPicker(container, book, this.onSelectGroup).render()
github mbraak / django-file-form / frontend / file_form.js View on Github external
addFile(filename, uploadIndex) {
    const div = document.createElement("div");
    div.className = `dff-file dff-file-id-${uploadIndex}`;

    const nameSpan = document.createElement("span");
    nameSpan.innerHTML = escape(filename);

    div.appendChild(nameSpan);
    this.container.appendChild(div);

    this.input.required = false;
    return div;
  }

escape-html

Escape string for use in HTML

MIT
Latest version published 9 years ago

Package Health Score

71 / 100
Full package analysis

Popular escape-html functions