<commit_before>'use strict';

import * as fs from 'fs';
import * as path from 'path';
import { ExtensionContext, languages, window, workspace } from 'vscode';
import * as completion from './completion';
import * as formatting from './formatting';
import * as listEditing from './listEditing';
import * as preview from './preview';
import * as print from './print';
import * as decorations from './syntaxDecorations';
import * as tableFormatter from './tableFormatter';
import * as toc from './toc';
import { getNewFeatureMsg, showChangelog } from './util';

export function activate(context: ExtensionContext) {
    activateMdExt(context);

    return {
        extendMarkdownIt(md) {
            return md.use(require('markdown-it-task-lists'))
                .use(require('@neilsustc/markdown-it-katex'));
        }
    }
}

function activateMdExt(context: ExtensionContext) {
    // Override `Enter`, `Tab` and `Backspace` keys
    listEditing.activate(context);
    // Shortcuts
    formatting.activate(context);
    // Toc
    toc.activate(context);
    // Syntax decorations
    decorations.activiate(context);
    // Images paths and math commands completions
    completion.activate(context);
    // Print to PDF
    print.activate(context);
    // Table formatter
    if (workspace.getConfiguration('markdown.extension.tableFormatter').get<boolean>('enabled')) {
        tableFormatter.activate(context);
    }
    // Auto show preview to side<commit_msg>💄 (katex) don't throw on error, #228<commit_after>'use strict';

import * as fs from 'fs';
import * as path from 'path';
import { ExtensionContext, languages, window, workspace } from 'vscode';
import * as completion from './completion';
import * as formatting from './formatting';
import * as listEditing from './listEditing';
import * as preview from './preview';
import * as print from './print';
import * as decorations from './syntaxDecorations';
import * as tableFormatter from './tableFormatter';
import * as toc from './toc';
import { getNewFeatureMsg, showChangelog } from './util';

export function activate(context: ExtensionContext) {
    activateMdExt(context);

    return {
        extendMarkdownIt(md) {
            return md.use(require('markdown-it-task-lists'))
                .use(require('@neilsustc/markdown-it-katex'), { "throwOnError": false });
        }
    }
}

function activateMdExt(context: ExtensionContext) {
    // Override `Enter`, `Tab` and `Backspace` keys
    listEditing.activate(context);
    // Shortcuts
    formatting.activate(context);
    // Toc
    toc.activate(context);
    // Syntax decorations
    decorations.activiate(context);
    // Images paths and math commands completions
    completion.activate(context);
    // Print to PDF
    print.activate(context);
    // Table formatter
    if (workspace.getConfiguration('markdown.extension.tableFormatter').get<boolean>('enabled')) {
        tableFormatter.activate(context);
    }
    // Auto show preview to side
{'fraction_non_alphanumeric': 0.12953020134228188, 'fraction_numerical': 0.0010067114093959733, 'mean_word_length': 3.482706766917293, 'pattern_counts': {'":': 1, '<': 5, '<?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': '61955', 'n_tokens_mistral': 846, 'n_tokens_neox': 815, 'n_words': 231}