<commit_before><!DOCTYPE html>
<html lang="en">
<head>
  <title>highlight.js developer</title>
  <meta charset="utf-8">

  <link rel="stylesheet" href="../src/styles/default.css">
  <script src="../build/highlight.pack.js"></script>
  <script src="../demo/jquery-2.1.1.min.js"></script>

  <script>
    $(document).ready(function() {
      var select = $('.languages');
      hljs.listLanguages().forEach(function(l) {
        select.append('<option>' + l + '</option>');
      });

      $('.editor button').click(function(e) {
        var editor = $(this).parents('.editor');
        var language = editor.find('.languages').val();
        var source = editor.find('textarea').val();
        var start_time = +new Date();
        var result = hljs.getLanguage(language) ? hljs.highlight(language, source) : hljs.highlightAuto(source);
        var rendering_time = +new Date() - start_time;
        editor.find('.hljs').html(result.value);
        var rendering_stats = result.language + ': ' + result.r;
        if (result.second_best) {
            rendering_stats += ', ' + result.second_best.language + ': ' + result.second_best.r;
        }
        editor.find('.rendering_stats').text(rendering_stats);
        editor.find('.rendering_time').text(rendering_time);
        editor.find('output').text(result.value);
        SourceStore.save(source, language);
      });
    });

    var SourceStore;
    (function(){
      SourceStore = {
        save: function(source, lang){
          localStorage.setItem(key_SOURCE, source);
          localStorage.setItem(key_LANG, lang);
        },
        resolve: function(){
          return [
            localStorage.getItem(key_SOURCE),
            localStorage.getItem(key_LANG)
          ];
        }
      };
      var key_SOURCE = 'hljs-source';
      var key_LANG = '<KEY>';
      $(function(){
        var data = SourceStore.resolve();
        if (data == null) return;
        $('.editor textarea').val(data[0]);
        $('.editor .languages').val(data[1]);
        $('.editor button').click();
      });
    }());
  </script>

  <style>
    .editor textarea {
      display: block; width: 100%;
      height: 15em;
    }

    pre code,
    pre output {
      display: block;
    }

    pre output {
      display: block; overflow: auto;
      padding: 0.5em;
      background: #F0F0F0;
    }
  </style>

<body>

<h1>highlight.js developer</h1>

<div class="editor">
  <div>
    <textarea>Put code here…</textarea>
    <p>
      <button>Update highlighting</button>
      Language: <select class="languages"><option>(Auto)</option></select>
    </p>
  </div>
  <div>
    <p>Rendered in <span class="rendering_time">...</span> ms [<span class="rendering_stats">...</span>]</p>
    <pre><code class="hljs">...</code></pre>
  </div>
  <div>
    <p>Markup
    <pre><output>...</output></pre>
  </div>
</div>
</body>
</html><commit_msg>Move style and link tags to the top<commit_after><!DOCTYPE html>
<html lang="en">
<head>
  <title>highlight.js developer</title>
  <meta charset="utf-8">

  <link rel="stylesheet" href="../src/styles/default.css">

  <style>
    .editor textarea {
      display: block; width: 100%;
      height: 15em;
    }

    pre code,
    pre output {
      display: block;
    }

    pre output {
      display: block; overflow: auto;
      padding: 0.5em;
      background: #F0F0F0;
    }
  </style>
  <script src="../build/highlight.pack.js"></script>
  <script src="../demo/jquery-2.1.1.min.js"></script>

  <script>
    $(document).ready(function() {
      var select = $('.languages');
      hljs.listLanguages().forEach(function(l) {
        select.append('<option>' + l + '</option>');
      });

      $('.editor button').click(function(e) {
        var editor = $(this).parents('.editor');
        var language = editor.find('.languages').val();
        var source = editor.find('textarea').val();
        var start_time = +new Date();
        var result = hljs.getLanguage(language) ? hljs.highlight(language, source) : hljs.highlightAuto(source);
        var rendering_time = +new Date() - start_time;
        editor.find('.hljs').html(result.value);
        var rendering_stats = result.language + ': ' + result.r;
        if (result.second_best) {
            rendering_stats += ', ' + result.second_best.language + ': ' + result.second_best.r;
        }
        editor.find('.rendering_stats').text(rendering_stats);
        editor.find('.rendering_time').text(rendering_time);
        editor.find('output').text(result.value);
        SourceStore.save(source, language);
      });
    });

    var SourceStore;
    (function(){
      SourceStore = {
        save: function(source, lang){
          localStorage.setItem(key_SOURCE, source);
          localStorage.setItem(key_LANG, lang);
        },
        resolve: function(){
          return [
            localStorage.getItem(key_SOURCE),
            localStorage.getItem(key_LANG)
          ];
        }
      };
      var key_SOURCE = 'hljs-source';
      var key_LANG = 'hljs-lang';
      $(function(){
        var data = SourceStore.resolve();
        if (data == null) return;
        $('.editor textarea').val(data[0]);
        $('.editor .languages').val(data[1]);
        $('.editor button').click();
      });
    }());
  </script>

<h1>highlight.js developer</h1>

<div class="editor">
  <div>
    <textarea>Put code here…</textarea>
    <p>
      <button>Update highlighting</button>
      Language: <select class="languages"><option>(Auto)</option></select>
    </p>
  </div>
  <div>
    <p>Rendered in <span class="rendering_time">...</span> ms [<span class="rendering_stats">...</span>]</p>
    <pre><code class="hljs">...</code></pre>
  </div>
  <div>
    <p>Markup
    <pre><output>...</output></pre>
  </div>
</div>
</body>
</html>
{'fraction_non_alphanumeric': 0.18512767425810905, 'fraction_numerical': 0.006211180124223602, 'mean_word_length': 2.4858689116055324, 'pattern_counts': {'":': 0, '<': 113, '<?xml version=': 0, '>': 113, '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': '7446893', 'n_tokens_mistral': 1865, 'n_tokens_neox': 1807, 'n_words': 333}