<commit_before>/**
 * adopted extension of https://github.com/cure53/DOMPurify
 */
import {attrs} from '../aria';
import dompurify from 'dompurify';
import PropTypes from "prop-types";
import React, {Component} from 'react';

export default class DomPurify extends Component {

  constructor(props, context) {
    super(props, context);
    this.displayName = 'components/DomPurify';
    this.state = { domPurifyOptions: this.props.domPurifyOptions || { ADD_ATTR: attrs } };
  };

  render() {
    return (<span className={this.props.className} dangerouslySetInnerHTML={ { __html: dompurify.sanitize( this.props.content, this.state.domPurifyOptions ) } } /> );
  }

}

DomPurify.propTypes = {
  content: PropTypes.string.required,
  className: PropTypes.string,
  domPurifyOptions: PropTypes.shape({
    ADD_ATTR: PropTypes.arrayOf(PropTypes.string)
  })
};<commit_msg>Added Documents to DomPurify tag<commit_after>/**
 * adopted extension of https://github.com/cure53/DOMPurify
 */
import {attrs} from '../aria';
import dompurify from 'dompurify';
import PropTypes from "prop-types";
import React, {Component} from 'react';

/**
 * DomPurify uses https://www.npmjs.com/package/dompurify to sanctify html suitable for ReactJS
 * @class
 */
export default class DomPurify extends Component {

  constructor(props, context) {
    super(props, context);
    this.displayName = 'components/DomPurify';
    this.state = { domPurifyOptions: this.props.domPurifyOptions || { ADD_ATTR: attrs } };
  };

  render() {
    return (<span className={this.props.className} dangerouslySetInnerHTML={ { __html: dompurify.sanitize( this.props.content, this.state.domPurifyOptions ) } } /> );
  }

}

/**
 * @type {{content, className: *, domPurifyOptions: *}}
 */
DomPurify.propTypes = {
  content: PropTypes.string.required,
  className: PropTypes.string,
  domPurifyOptions: PropTypes.shape({
    ADD_ATTR: PropTypes.arrayOf(PropTypes.string)
  })
};
{'fraction_non_alphanumeric': 0.13953488372093023, 'fraction_numerical': 0.0020671834625322996, 'mean_word_length': 4.484419263456091, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 3, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5689634', 'n_tokens_mistral': 619, 'n_tokens_neox': 602, 'n_words': 132}