How to use the he.unescape function in he

To help you get started, we’ve selected a few he 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 microsoft / BotFramework-WebChat / built / FormattedText.js View on Github external
return '';
            });
            if (text.length == 0)
                break;
            // Consume leak sequences until string end or an id sequence is encountered
            var next = text.indexOf('{{');
            while (next > 0) {
                var subst = text.substr(0, next);
                subst = He.unescape(subst);
                elements.push(React.createElement("span", { key: this.key++ }, subst));
                text = text.substr(next);
                next = text.indexOf('{{');
            }
            // Return remainder leak sequence
            if (len == text.length) {
                text = He.unescape(text);
                elements.push(React.createElement("span", { key: this.key++ }, text));
                break;
            }
        }
        return elements.filter(function (el) { return !!el; });
    };
    /// MarkedRenderer overrides
github microsoft / BotFramework-WebChat / built / FormattedText.js View on Github external
while (true) {
            var len = text.length;
            // Consume elementIds until string end or a leak sequence is encountered
            text = text.replace(re, function (match) {
                var index = Number(match.match(/\d+/)[0]);
                elements.push(_this.elements[index]);
                _this.elements[index] = null;
                return '';
            });
            if (text.length == 0)
                break;
            // Consume leak sequences until string end or an id sequence is encountered
            var next = text.indexOf('{{');
            while (next > 0) {
                var subst = text.substr(0, next);
                subst = He.unescape(subst);
                elements.push(React.createElement("span", { key: this.key++ }, subst));
                text = text.substr(next);
                next = text.indexOf('{{');
            }
            // Return remainder leak sequence
            if (len == text.length) {
                text = He.unescape(text);
                elements.push(React.createElement("span", { key: this.key++ }, text));
                break;
            }
        }
        return elements.filter(function (el) { return !!el; });
    };
    /// MarkedRenderer overrides
github philipwalton / blog / tasks / utils / markdown.js View on Github external
highlight: function(code, lang) {
      // TODO(philipwalton): come up with a better way to do code marking.
      let mark = true;
      if (lang.includes(':no-mark')) {
        mark = false;
        lang = lang.replace(':no-mark', '');
      }

      code = lang ? hljs.highlight(lang, code).value :
          // Since we're not using highlight.js here, we need to
          // espace the html, but we have to unescape first in order
          // to avoid double escaping.
          he.escape(he.unescape(code));

      // Allow for highlighting portions of code blocks
      // using `**` before and after
      if (mark) {
        code = code.replace(/\*\*(.+)?\*\*/g, '<mark>$1</mark>');
      }

      return code;
    },
  }).use(markdownItAnchor);
github PierreBresson / Thinkerview / app / services / staticServices / cleanWPjson.js View on Github external
json.map(json_item =&gt; {
    let item = {
      id: json_item.id,
      categories: json_item.categories,
      title: he.unescape(json_item.title.rendered),
      body: he.unescape(
        json_item.excerpt.rendered.replace(/&lt;\/?[^&gt;]+(&gt;|$)/g, "")
      ),
      img_url: getYoutubeVideoImageURL(json_item.acf.youtube),
      video_id: getYoutubeVideoID(json_item.acf.youtube),
      audio_link:
        config.urls.api.podcast_download +
        json_item.id +
        "/" +
        json_item.slug +
        ".mp3?ref=appthk"
    };
    cleanJSON.push(item);
  });
  return cleanJSON;
github kiibohd / configurator / src / renderer / configure / onscreen-keyboard.js View on Github external
function label(i) {
    const layer = data.layers[i.toString()];
    const label1 = he.unescape((layer &amp;&amp; layer.label1) || ' ');
    const label2 = layer &amp;&amp; layer.label2 &amp;&amp; he.unescape(layer.label2);
    const color = getLayerFg(i);
    const style = layer &amp;&amp; { ...layer.style, ...{ color } };

    return (
      <div style="{style}">
        <span>{label1}</span>
        {label2 &amp;&amp; <span>{label2}</span>}
      </div>
    );
  }
}
github hello-efficiency-inc / raven-reader / src / renderer / components / SubscribeModal.vue View on Github external
res.feedUrls.map(item => {
                  item.title = he.unescape(item.title)
                  if (isXML) {
                    item.url = self.feed_url
                  }
                  return item
                })
                if (res.feedUrls.length === 0) {
github pietheinstrengholt / rssmonster / server / util / parser.js View on Github external
feed.posts.map((item) => {
    item.favourite = false
    item.read = false
    item.offline = false
    if (item.summary) {
      item.summary = he.unescape(item.summary)
    }
    return item
  })
  return feed
github RocketChat / Rocket.Chat / packages / rocketchat-oembed / server / server.js View on Github external
content.body.replace(/]*(?:name|property)=[']([^']*)['][^&gt;]*\scontent=[']([^']*)['][^&gt;]*&gt;/gmi, function(meta, name, value) {
			let name1;
			return metas[name1 = changeCase.camelCase(name)] != null ? metas[name1] : metas[name1] = he.unescape(value);
		});
		content.body.replace(/]*(?:name|property)=["]([^"]*)["][^&gt;]*\scontent=["]([^"]*)["][^&gt;]*&gt;/gmi, function(meta, name, value) {
github hello-efficiency-inc / raven-reader / src / renderer / parsers / feed.js View on Github external
feed.posts.map((item) => {
    item.favourite = false
    item.read = false
    item.offline = false
    item.favicon = null
    item.feed_title = feed.meta.title
    item.feed_url = feed.meta.xmlurl
    item.feed_link = feed.meta.link
    if (item.content) {
      item.content = he.unescape(item.content)
    }
    return item
  })
  return feed

he

A robust HTML entities encoder/decoder with full Unicode support.

MIT
Latest version published 6 years ago

Package Health Score

70 / 100
Full package analysis