<commit_before>export module ViewsExtra {

    let remarkable: any;

    declare var Remarkable: any;
    declare var hljs: any;
    declare var MathJax: any;

    export function init() {

        try {
            remarkable = new Remarkable({

                html: false,
                xhtmlOut: true,
                linkify: true,
                linkTarget: '_blank',
                typographer: true,
                quotes: '“”‘’',
                highlight: highlightCode
            });
        }
        catch (ex) {
        }
    }

    function highlightCode(value: string, language: string): string {

        try {
            if (language && language.length) {

                return hljs.highlight(language, value).value;
            }
            else {

                return hljs.highlightAuto(value).value;
            }
        }
        catch (ex) {

            return '';
        }
    }

    export function expandContent(content: string): string {

        try {
            return remarkable.render(content);
        }
        catch (ex) {

            return 'Error while rendering';
        }
    }

    export function refreshMath(element: HTMLElement): void {

        setTimeout(() => {
            try {
                MathJax.Hub.Queue(["Typeset", MathJax.Hub, element]);
            }
            catch (ex) {
            }
        }, 100);
    }

    export function adjustMessageContent(container: HTMLElement): void {

        let contentElements = container.querySelectorAll('.message-content');

        for (let i = 0; i < contentElements.length; ++i) {

            let element = contentElements[i];

            let tables = element.querySelectorAll('table');
            for (let ti = 0; ti < tables.length; ++ti) {

                let table = tables[ti];
                table.classList.add('uk-table', 'uk-table-small', 'uk-table-striped');
            }
        }
    }
}<commit_msg>Added rel=nofollow to links rendered from markdown<commit_after>export module ViewsExtra {

    let remarkable: any;

    declare var Remarkable: any;
    declare var hljs: any;
    declare var MathJax: any;

    export function init() {

        try {
            remarkable = new Remarkable({

                html: false,
                xhtmlOut: true,
                linkify: true,
                linkTarget: '_blank',
                typographer: true,
                quotes: '“”‘’',
                highlight: highlightCode
            });
        }
        catch (ex) {
        }
    }

    function highlightCode(value: string, language: string): string {

        try {
            if (language && language.length) {

                return hljs.highlight(language, value).value;
            }
            else {

                return hljs.highlightAuto(value).value;
            }
        }
        catch (ex) {

            return '';
        }
    }

    export function expandContent(content: string): string {

        try {
            return remarkable.render(content);
        }
        catch (ex) {

            return 'Error while rendering';
        }
    }

    export function refreshMath(element: HTMLElement): void {

        setTimeout(() => {
            try {
                MathJax.Hub.Queue(["Typeset", MathJax.Hub, element]);
            }
            catch (ex) {
            }
        }, 100);
    }

    export function adjustMessageContent(container: HTMLElement): void {

        let contentElements = container.querySelectorAll('.message-content');

        for (let i = 0; i < contentElements.length; ++i) {

            let element = contentElements[i];

            let tables = element.querySelectorAll('table');
            for (let ti = 0; ti < tables.length; ++ti) {

                let table = tables[ti];
                table.classList.add('uk-table', 'uk-table-small', 'uk-table-striped');
            }
        }

        let links = container.getElementsByTagName('a');
        for (let i = 0; i < links.length; ++i) {

            let link = links[i];
            link.setAttribute('rel', 'nofollow');
        }
    }
}
{'fraction_non_alphanumeric': 0.1098153547133139, 'fraction_numerical': 0.002672497570456754, 'mean_word_length': 1.4433234421364984, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 5, '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': '4468468', 'n_tokens_mistral': 1132, 'n_tokens_neox': 1056, 'n_words': 261}