<commit_before>(function($){
  $.MarkdownSettings = {
    previewParserPath:  '',
    onShiftEnter:    {keepDefault:false, openWith:'\n\n'},
    markupSet: [
      {name:'First Level Heading', key:'1', placeHolder:'Your title here...',
        closeWith:function(markItUp) { return markdownTitle(markItUp, '=') } },
      {name:'Second Level Heading', key:'2', placeHolder:'Your title here...',
        closeWith:function(markItUp) { return markdownTitle(markItUp, '-') } },
      {name:'Heading 3', key:'3', openWith:'### ', placeHolder:'Your title here...' },
      {name:'Heading 4', key:'4', openWith:'#### ', placeHolder:'Your title here...' },
      {name:'Heading 5', key:'5', openWith:'##### ', placeHolder:'Your title here...' },
      {name:'Heading 6', key:'6', openWith:'###### ', placeHolder:'Your title here...' },
      {separator:'---------------' },
      {name:'Bold', key:'B', openWith:'**', closeWith:'**'},
      {name:'Italic', key:'I', openWith:'_', closeWith:'_'},
      {separator:'---------------' },
      {name:'Bulleted List', openWith:'- ' },
      {name:'Numeric List', openWith:function(markItUp) {
        return markItUp.line+'. ';
      }},
      {separator:'---------------' },
      {name:'Picture', key:'P', replaceWith:'![[![Alternative text]!]]([![Url:!:http://]!] "[![Title]!]")'},
      {name:'Link', key:'L', openWith:'[', closeWith:']([![Url:!:http://]!] "[![Title]!]")', placeHolder:'Your text to link here...' },
      {name:'Video', key:'V', className:'tinyUrl', openWith:function(markItUp) { return findVideo(markItUp) } },
      {separator:'---------------'},
      {name:'Quotes', openWith:'> '},
      {name:'Code Block / Code', openWith:'(!(\t|!|`)!)', closeWith:'(!(`)!)'},
      {separator:'---------------'}
    ]
  }

  function findVideo(markItUp) {
    var url, image = "no-image", title = "no-title";
    url = prompt("Url:", "http://");
    if (url) {
      $.ajaxSetup({ async: false });
      $.getJSON("/admin/posts/video_info.json", {url: url}, function(obj) {
        if(obj && obj["video"]){
          url   = obj["video"]["url"];
          title = obj["video"]["title"];
          image = '!['+title+']('+obj["video"]["thumbnail_large"]+')';
        }
      });
      return '['+image+']('+url+' "'+title+'")';
    }
  }

  function markdownTitle(markItUp, char) {
    heading = '';
    n = $.trim(markItUp.selection||markItUp.placeHolder).length;
    for(i = 0; i < n; i++) {
      heading += char;<commit_msg>change ajax syntax<commit_after>(function($){
  $.MarkdownSettings = {
    previewParserPath:  '',
    onShiftEnter:    {keepDefault:false, openWith:'\n\n'},
    markupSet: [
      {name:'First Level Heading', key:'1', placeHolder:'Your title here...',
        closeWith:function(markItUp) { return markdownTitle(markItUp, '=') } },
      {name:'Second Level Heading', key:'2', placeHolder:'Your title here...',
        closeWith:function(markItUp) { return markdownTitle(markItUp, '-') } },
      {name:'Heading 3', key:'3', openWith:'### ', placeHolder:'Your title here...' },
      {name:'Heading 4', key:'4', openWith:'#### ', placeHolder:'Your title here...' },
      {name:'Heading 5', key:'5', openWith:'##### ', placeHolder:'Your title here...' },
      {name:'Heading 6', key:'6', openWith:'###### ', placeHolder:'Your title here...' },
      {separator:'---------------' },
      {name:'Bold', key:'B', openWith:'**', closeWith:'**'},
      {name:'Italic', key:'I', openWith:'_', closeWith:'_'},
      {separator:'---------------' },
      {name:'Bulleted List', openWith:'- ' },
      {name:'Numeric List', openWith:function(markItUp) {
        return markItUp.line+'. ';
      }},
      {separator:'---------------' },
      {name:'Picture', key:'P', replaceWith:'![[![Alternative text]!]]([![Url:!:http://]!] "[![Title]!]")'},
      {name:'Link', key:'L', openWith:'[', closeWith:']([![Url:!:http://]!] "[![Title]!]")', placeHolder:'Your text to link here...' },
      {name:'Video', key:'V', className:'tinyUrl', openWith:function(markItUp) { return findVideo(markItUp) } },
      {separator:'---------------'},
      {name:'Quotes', openWith:'> '},
      {name:'Code Block / Code', openWith:'(!(\t|!|`)!)', closeWith:'(!(`)!)'},
      {separator:'---------------'}
    ]
  }

  function findVideo(markItUp) {
    var url, image = "no-image", title = "no-title";
    url = prompt("Url:", "http://");
    if (url) {
      $.ajax({ url: "/admin/posts/video_info.json", data: { url: url },
        dataType: 'json', async: false,
        success: function(obj) {
          if(obj && obj["video"]){
            url   = obj["video"]["url"];
            title = obj["video"]["title"];
            image = '!['+title+']('+obj["video"]["thumbnail_large"]+')';
          }
        }
      });
      return '['+image+']('+url+' "'+title+'")';
    }
  }

  function markdownTitle(markItUp, char) {
    heading = '';
    n = $.trim(markItUp.selection||markItUp.placeHolder).length;
    for(i = 0; i < n; i++) {
      heading += char;
{'fraction_non_alphanumeric': 0.2762816676640734, 'fraction_numerical': 0.004388589666866148, 'mean_word_length': 2.94492525570417, 'pattern_counts': {'":': 0, '<': 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': '2219038', 'n_tokens_mistral': 1649, 'n_tokens_neox': 1630, 'n_words': 302}