<commit_before>import { SchemaItem } from './schema-item';
import sanitizeHtml = require( 'sanitize-html' );

/**
* An html scheme item for use in Models
*/
export class SchemaHtml extends SchemaItem<string> {
    /**
     * The default tags allowed
     * includes: h3, h4, h5, h6, blockquote, p, a, ul, ol,
     *    nl, li, b, i, strong, em, strike, code, hr, br, div,
     *    table, thead, caption, tbody, tr, th, td, pre
     */
    public static defaultTags: Array<string> = [ 'h3', 'h4', 'h5', 'h6', 'blockquote', 'p', 'a', 'ul', 'ol',
        'nl', 'li', 'b', 'i', 'strong', 'em', 'strike', 'code', 'hr', 'br', 'div', 'iframe',
        'table', 'thead', 'caption', 'tbody', 'tr', 'th', 'td', 'pre' ];

    /**
     * The default allowed attributes for each tag
     */
    public static defaultAllowedAttributes: { [ name: string ]: Array<string> } = {
        a: [ 'href', 'name', 'target' ],
        img: [ 'src' ],
        iframe: [ 'src', 'width', 'height', 'frameborder', 'allowfullscreen' ]
    };

    public allowedTags: Array<string>;
    public allowedAttributes: { [ name: string ]: Array<string> };
    public errorBadHTML: boolean;<commit_msg>Added support for image common attributes<commit_after>import { SchemaItem } from './schema-item';
import sanitizeHtml = require( 'sanitize-html' );

/**
* An html scheme item for use in Models
*/
export class SchemaHtml extends SchemaItem<string> {
    /**
     * The default tags allowed
     * includes: h3, h4, h5, h6, blockquote, p, a, ul, ol,
     *    nl, li, b, i, strong, em, strike, code, hr, br, div,
     *    table, thead, caption, tbody, tr, th, td, pre
     */
    public static defaultTags: Array<string> = [ 'h3', 'h4', 'h5', 'h6', 'blockquote', 'p', 'a', 'ul', 'ol',
        'nl', 'li', 'b', 'i', 'strong', 'em', 'strike', 'code', 'hr', 'br', 'div', 'iframe',
        'table', 'thead', 'caption', 'tbody', 'tr', 'th', 'td', 'pre' ];

    /**
     * The default allowed attributes for each tag
     */
    public static defaultAllowedAttributes: { [ name: string ]: Array<string> } = {
        a: [ 'href', 'name', 'target' ],
        img: [ 'src', 'style', 'width', 'height', 'id', 'class' ],
        iframe: [ 'src', 'width', 'height', 'frameborder', 'allowfullscreen' ]
    };

    public allowedTags: Array<string>;
    public allowedAttributes: { [ name: string ]: Array<string> };
    public errorBadHTML: boolean;
{'fraction_non_alphanumeric': 0.1951727007906783, 'fraction_numerical': 0.006658343736995423, 'mean_word_length': 3.1376936316695354, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '5922286', 'n_tokens_mistral': 809, 'n_tokens_neox': 795, 'n_words': 255}