<commit_before>
// Markdown helpers for Codemirror

function CMMD(editor) {
    this.editor = editor;
}

CMMD.prototype.wrap = function(start, middle, end) {

    if (this.editor.somethingSelected()) {
        var text = this.editor.getSelection();
        this.editor.replaceSelection(start + text + end);
        return;
    }

    var c = this.editor.getCursor();

    this.editor.replaceRange(start+middle+end, c, c);

    this.editor.setSelection({
        line: c.line,
        ch: c.ch + start.length
    }, {
        line: c.line,
        ch: c.ch + start.length + middle.length
    });

    this.editor.focus();
};

CMMD.prototype.bold = function() {
    this.wrap("**", "Bold Text", "**");
};

CMMD.prototype.italics = function() {
    this.wrap("*", "Italic Text", "*");
};

CMMD.prototype.heading1 = function() {
    this.wrap("# ", "Heading 1", "");
};

CMMD.prototype.heading2 = function() {
    this.wrap("## ", "Heading 2", "");
};

CMMD.prototype.heading3 = function() {
    this.wrap("### ", "Heading 3", "");
};


CMMD.prototype.link = function() {
    this.wrap("[", "Link Title", "](%base_url%/subpage)");
};

CMMD.prototype.image = function() {
    this.editor.replaceSelection(text);<commit_msg>fix image button<commit_after>
// Markdown helpers for Codemirror

function CMMD(editor) {
    this.editor = editor;
}

CMMD.prototype.wrap = function(start, middle, end) {

    if (this.editor.somethingSelected()) {
        var text = this.editor.getSelection();
        this.editor.replaceSelection(start + text + end);
        return;
    }

    var c = this.editor.getCursor();

    this.editor.replaceRange(start+middle+end, c, c);

    this.editor.setSelection({
        line: c.line,
        ch: c.ch + start.length
    }, {
        line: c.line,
        ch: c.ch + start.length + middle.length
    });

    this.editor.focus();
};

CMMD.prototype.bold = function() {
    this.wrap("**", "Bold Text", "**");
};

CMMD.prototype.italics = function() {
    this.wrap("*", "Italic Text", "*");
};

CMMD.prototype.heading1 = function() {
    this.wrap("# ", "Heading 1", "");
};

CMMD.prototype.heading2 = function() {
    this.wrap("## ", "Heading 2", "");
};

CMMD.prototype.heading3 = function() {
    this.wrap("### ", "Heading 3", "");
};


CMMD.prototype.link = function() {
    this.wrap("[", "Link Title", "](%base_url%/subpage)");
};

CMMD.prototype.image = function() {
{'fraction_non_alphanumeric': 0.1979991663192997, 'fraction_numerical': 0.005002084201750729, 'mean_word_length': 2.9603960396039604, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6902648', 'n_tokens_mistral': 826, 'n_tokens_neox': 815, 'n_words': 150}