<commit_before>/* global Showdown, Handlebars, html_sanitize*/
import cajaSanitizers from 'ghost/utils/caja-sanitizers';

var showdown = new Showdown.converter({extensions: ['ghostimagepreview', 'ghostgfm']});

var formatMarkdown = Ember.Handlebars.makeBoundHelper(function (markdown) {
    var html = '';

    // replace script and iFrame
    markdown = markdown.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, '```\nEmbedded JavaScript\n```');
    markdown = markdown.replace(/<iframe\b[^<]*(?:(?!<\/iframe>)<[^<]*)*<\/iframe>/gi, '```\nEmbedded IFrame\n```');

    // convert markdown to HTML
    html = showdown.makeHtml(markdown || '');

    // sanitize html
    html = html_sanitize(html, cajaSanitizers.url, cajaSanitizers.id);
    return new Handlebars.SafeString(html);
});

export default formatMarkdown;<commit_msg>Changing second half of script placeholders<commit_after>/* global Showdown, Handlebars, html_sanitize*/
import cajaSanitizers from 'ghost/utils/caja-sanitizers';

var showdown = new Showdown.converter({extensions: ['ghostimagepreview', 'ghostgfm']});

var formatMarkdown = Ember.Handlebars.makeBoundHelper(function (markdown) {
    var html = '';

    // replace script and iFrame
    markdown = markdown.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
        '<pre class="js-embed-placeholder">Embedded JavaScript</pre>');
    markdown = markdown.replace(/<iframe\b[^<]*(?:(?!<\/iframe>)<[^<]*)*<\/iframe>/gi,
        '<pre class="iframe-embed-placeholder">Embedded iFrame</pre>');

    // convert markdown to HTML
    html = showdown.makeHtml(markdown || '');

    // sanitize html
    html = html_sanitize(html, cajaSanitizers.url, cajaSanitizers.id);
    return new Handlebars.SafeString(html);
});

export default formatMarkdown;
{'fraction_non_alphanumeric': 0.18973214285714285, 'fraction_numerical': 0.0, 'mean_word_length': 4.674050632911392, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 15, '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': '3195192', 'n_tokens_mistral': 617, 'n_tokens_neox': 580, 'n_words': 108}