How to use striptags - 10 common examples

To help you get started, we’ve selected a few striptags 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 mozilla / notes / native / app / utils / utils.js View on Github external
function secondLine(content) {
  // Remove first line
  let res = striptags(content.replace(/>\n<')).replace(/ /gi, ' ').trim().split('\n');
  content = res.slice(1, 10).join(' ').trim();

  if (!content) return '';
  return content.substr(0, 250).replace(/&/g, '&');
}
github clay / clay-kiln / inputs / magic-button-transformers.js View on Github external
function toPlainText(str) {
  // coerce all text into a string. Undefined stuff is just an empty string
  if (!_.isString(str)) {
    return '';
  }

  return decode(striptags(str.replace(' ', ' ')));
}
github DefinitelyTyped / DefinitelyTyped / striptags / striptags-tests.ts View on Github external
function testStriptags() {
    var html =
        '<a href="https://example.com">' +
            'lorem ipsum <strong>dolor</strong> <em>sit</em> amet' +
        '</a>';

    striptags(html);
    striptags(html, '<a><strong>');
    striptags(html, ['a']);
}</strong></a>
github phenomic / phenomic / packages / plugin-renderer-react / src / components / textRenderer.js View on Github external
const textRenderer = (tree?: ItemType) => {
  if (typeof tree === "undefined") {
    console.error(
      "@phenomic/plugin-renderer-react: textRenderer expects at least a child",
    );
    return "";
  }

  if (typeof tree === "string") {
    return striptags(tree);
  }

  return render(tree);
};
github hello-efficiency-inc / raven-reader / app / helpers / feeds.js View on Github external
articles: articles.map(item => {
        return {
          guid: item.guid,
          author: item.author,
          source: item.source,
          title: he.decode(item.title),
          read: false,
          favourite: false,
          summary: _.truncate.prune(he.decode(striptags(item.summary)), 120),
          tags: [],
          link: item.origlink ? item.origlink : item.link,
          pubDate: moment(item.pubDate).format('X')
        }
      })
    }
github clay / clay-kiln / lib / validators / built-in / soft-maxlength.js View on Github external
function cleanValue(value) {
  return decode(striptags(value));
}
github getgridea / gridea / src / helpers / words-count.ts View on Github external
function countContent(content: any): [number, number] {
  if (typeof content !== 'string') {
    throw new Error('[word-counter] content must be string type')
  }
  let cn = 0
  let en = 0
  if (content.length > 0) {
    content = striptags(content)
    cn = (content.match(CN_PATTERN) || []).length
    en = (content.replace(CN_PATTERN, '').match(EN_PATTERN) || []).length
  }
  return [cn, en]
}
github gambitph / Stackable / src / block / feature-grid / deprecated.js View on Github external
}, design, i, props ) )

				const itemStyles = applyFilters( 'stackable.feature-grid.itemstyles_1_17_2', {
					image: {
						width: imageUrl ? `${ imageSize }%` : undefined,
					},
				}, design, i, props )

				return (
					<div style="{">
						{ imageUrl &amp;&amp;
							<div>
								<img title="" alt="{" style="{" src="{">
							</div>
						}
						<div>
							{ ! RichText.isEmpty( title ) &amp;&amp; (
								
							) }
							{ ! RichText.isEmpty( description ) &amp;&amp; (
								</div></div>
github gambitph / Stackable / src / block / image-box / save.js View on Github external
{ range( 1, columns + 1 ).map( i => {
					const subtitle = attributes[ `subtitle${ i }` ]
					const title = attributes[ `title${ i }` ]
					const description = attributes[ `description${ i }` ]
					const ariaLabel = striptags(
						( showTitle && ! RichText.isEmpty( title ) ) ? title :
							( showSubtitle && ! RichText.isEmpty( subtitle ) ) ? subtitle :
								( showDescription && ! RichText.isEmpty( description ) ) ? description :
									''
					)

					const itemClasses = classnames( [
						'ugb-image-box__item',
						`ugb-image-box__item${ i }`,
						'ugb-image-box__box',
					], applyFilters( 'stackable.image-box.itemclasses', {
						[ `ugb--shadow-${ shadow }` ]: show.columnBackground && shadow !== '',
					}, props, i ) )

					const rel = []
					if ( attributes[ `link${ i }NewTab` ] ) {

striptags

PHP strip_tags in Node.js

MIT
Latest version published 4 years ago

Package Health Score

65 / 100
Full package analysis

Popular striptags functions