How to use the escape-goat.escapeTag function in escape-goat

To help you get started, we’ve selected a few escape-goat 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 emotion-js / emotion / site / plugins / gatsby-remark-live-code / index.js View on Github external
if (node.lang === 'jsx live') {
      throw new Error(
        `The following code block has the language jsx live which is no longer allowed:\n${
          node.value
        }`
      )
    }
    if (
      node.lang === 'jsx' &&
      // yes, i know this won't work if you don't use line comments and stuff
      // but adding a whole js parser and stuff to do this would be more effort than it's worth
      livePattern.test(node.value)
    ) {
      let cleanValue = node.value.replace('// @live', '').trim()
      node.type = `html`
      node.value = escapeGoat.escapeTag``
    }
  })
}
github focusaurus / peterlyons.com / app / play / photos / photos-main.js View on Github external
/* global window document */
const tag = require("escape-goat").escapeTag;

const pageState = {};

function dom(selector) {
  return document.querySelector(`.view-gallery ${selector}`);
}

function thumbnail(photo) {
  return tag`<a href="${photo.pageURI}" class="thumbnail">
  <img title="${photo.caption}" alt="${photo.caption}" src="${photo.thumbnailURI}" data-photo-name="${photo.name}" class="thumbnail">
  </a>`;
}
github AJInteractive / InterviewJS / packages / lambda / story.js View on Github external
}, (err, data) =&gt; {
      if (err) return callback(err);

      const meta = [];
      meta.push(escapeGoat.escapeTag`<title>${story.title}</title>`);
      meta.push(escapeGoat.escapeTag``);
      meta.push(escapeGoat.escapeTag``);
      meta.push(escapeGoat.escapeTag``);
      meta.push(escapeGoat.escapeTag``);

      const index = data.Body.toString("utf-8")
        .replace("/sample-story/sample-story.js", "./story.js")
        .replace("", `\n${meta.join("\n")}`);

      s3.putObject({
        Body: `window.InterviewJS.story = ${JSON.stringify(story)};`,
        ACL: "public-read",
        ContentType: "application/javascript",
        Bucket: storyBucket,
        Key: `${publishId}/story.js`
      }, (err, response) =&gt; {
        if (err) return callback(err);

        s3.putObject({
          Body: index,

escape-goat

Escape a string for use in HTML or the inverse

MIT
Latest version published 3 years ago

Package Health Score

70 / 100
Full package analysis