How to use the entities.encodeHTML function in entities

To help you get started, we’ve selected a few entities 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 weseek / growi / src / client / js / legacy / crowi.js View on Github external
$('#view-list .page-list-ul-flat .page-list-link').each(function() {
    const $link = $(this);
    /* eslint-disable-next-line no-unused-vars */
    const text = $link.text();
    let path = decodeURIComponent($link.data('path'));
    const shortPath = decodeURIComponent($link.data('short-path')); // convert to string

    if (path == null || shortPath == null) {
      // continue
      return;
    }

    path = entities.encodeHTML(path);
    const pattern = `${escapeStringRegexp(entities.encodeHTML(shortPath))}(/)?$`;

    $link.html(path.replace(new RegExp(pattern), `<strong>${shortPath}$1</strong>`));
  });
github weswigham / metalsmith-metallic / lib / index.js View on Github external
break;
                }

                endpos = ends.index;
                replacements.push(str.substring(prev, pos - buff));

                remainder = str.substring(pos + endpos + 3);
                var code = str.substring(pos, pos + endpos);
                code = code.trim('(\r\n|\n)');
                pos = pos + endpos + 3;
                if (lang === null) {
                    replacements.push('<pre><code class="hljs">' + hljs.highlightAuto(code).value + '</code></pre>');
                } else {
                    try {
                        if (lang === 'no-highlight') {
                            replacements.push('<pre><code class="hljs ' + lang + '">' + entities.encodeHTML(code) + '</code></pre>');
                        } else {
                            replacements.push('<pre><code class="hljs ' + lang + '">' + hljs.highlight(lang, code).value + '</code></pre>');
                        }
                    } catch (err) {
                        replacements.push('<pre><code>' + hljs.highlightAuto(code).value + '</code></pre>');
                    }
                }
            }
            if (pos &lt; (str.length - 1)) {
                replacements.push(str.substring(pos));
            }

            files[file].contents = new Buffer(replacements.join(''));
            debug(files[file].contents.toString());
        });
    };
github brussell98 / Mirai / bot / commands.js View on Github external
process: function(bot, msg, suffix) {
			if (suffix &amp;&amp; suffix.toLowerCase() == 'me') bot.sendMessage(msg, `💀 `);
			else if (suffix) bot.sendMessage(msg, `💀 `);
			else bot.sendMessage(msg, "💀 ");
		}
	},
github brussell98 / Mirai / bot / commands.js View on Github external
process: function(bot, msg, suffix) {
			if (suffix &amp;&amp; suffix.toLowerCase() == 'me') bot.sendMessage(msg, `💀 `);
			else if (suffix) bot.sendMessage(msg, `💀 `);
			else bot.sendMessage(msg, "💀 ");
		}
	},
github weseek / growi / src / server / util / middlewares.js View on Github external
swig.setFilter('encodeHTML', (string) => {
        return entities.encodeHTML(string);
      });
github weseek / growi / resource / js / util / LangProcessor / PlantUML.js View on Github external
process(code, lang) {
    const config = crowi.getConfig();
    if (!config.env.PLANTUML_URI) {
      return `<pre class="wiki-code"><code>${entities.encodeHTML(code)}\n</code></pre>`;
    }

    let plantumlUri = config.env.PLANTUML_URI;
    if (plantumlUri.substr(-1) !== '/') {
      plantumlUri += '/';
    }
    const id = this.generateId(code + lang);
    const encoded = plantuml.encode(`@startuml

skinparam monochrome true

${code}
@enduml`);

    return `
      <div class="plantuml noborder" id="${id}"></div>
github riophae / vue-treeselect / docs / components / utils.js View on Github external
export const code = str =&gt; `<code>${encodeHTML(str)}</code>`
github riophae / vue-treeselect / docs / components / DocProps.vue View on Github external
type: 'Boolean',
        defaultValue: code('false'),
        description: 'When user selects a node, automatically select its ancestors. Applies to flat mode only.',
      }, {
        name: 'autoSelectDescendants',
        type: 'Boolean',
        defaultValue: code('false'),
        description: 'When user selects a node, automatically select its descendants. Applies to flat mode only.',
      }, {
        name: 'backspaceRemoves',
        type: 'Boolean',
        defaultValue: code('true'),
        description: 'Whether <kbd>Backspace</kbd> removes the last item if there is no text input.',
      }, {
        name: 'beforeClearAll',
        type: encodeHTML(`Fn${makeArgNameList([])} 🡒 (Boolean | Promise)`),
        defaultValue: code('() =&gt; true'),
        description: `Function that processes before clearing all input fields. Return ${code('false')} to stop values being cleared.`,
      }, {
        name: 'branchNodesFirst',
        type: 'Boolean',
        defaultValue: code('false'),
        description: 'Show branch nodes before leaf nodes.',
      }, {
        name: 'cacheOptions',
        type: 'Boolean',
        defaultValue: code('true'),
        description: `Whether to cache results of each search request for ${link('#async-searching', 'async search mode')}.`,
      }, {
        name: 'clearable',
        type: 'Boolean',
        defaultValue: code('true'),
github yegor-sytnyk / contoso-express / server / src / server.ts View on Github external
hbs.registerHelper('json', function(obj) {
        let jsonValue = JSON.stringify(obj);

        let val = entities.encodeHTML(jsonValue);

        return new hbs.SafeString(val);
    });