<commit_before>module ApplicationHelper

  def organization_options
    current_user.organizations.collect { |o|
      [
        o.organization.login,
        o.organization.login,
        { 'data-content' => "<img src='#{o.organization.avatar_url}' height='20' width='20' /> #{o.organization.login}" }
      ]
    }
  end

  def user_option
    [
      current_user.github_username,
      nil,
      { 'data-content' => "<img src='#{current_user.github_user.avatar_url}' height='20' width='20' /> #{current_user.github_username}" }
    ]
  end

  def organization_select_options
    organization_options.unshift(user_option)
  end

  class CodeRayify < Redcarpet::Render::HTML
    def block_code(code, language)
        CodeRay.scan(code, language).div
    end
  end

  def markdown(text)
      coderayified = CodeRayify.new(filter_html: true,  hard_wrap: true)
      options = {
          fenced_code_blocks: true,
          no_intra_emphasis: true,
          autolink: true,
          strikethrough: true,
          lax_html_blocks: true,
          superscript: true
      }
      markdown_to_html = Redcarpet::Markdown.new(coderayified, options)
      markdown_to_html.render(text).html_safe
  end

  def markdown_json(json_text)
    markdown("```json\n#{json_text}```")
  end

end
<commit_msg>Update so that json is 'pretty' printed too<commit_after>module ApplicationHelper

  def organization_options
    current_user.organizations.collect { |o|
      [
        o.organization.login,
        o.organization.login,
        { 'data-content' => "<img src='#{o.organization.avatar_url}' height='20' width='20' /> #{o.organization.login}" }
      ]
    }
  end

  def user_option
    [
      current_user.github_username,
      nil,
      { 'data-content' => "<img src='#{current_user.github_user.avatar_url}' height='20' width='20' /> #{current_user.github_username}" }
    ]
  end

  def organization_select_options
    organization_options.unshift(user_option)
  end

  class CodeRayify < Redcarpet::Render::HTML
    def block_code(code, language)
        CodeRay.scan(code, language).div
    end
  end

  def markdown(text)
      coderayified = CodeRayify.new(filter_html: true,  hard_wrap: true)
      options = {
          fenced_code_blocks: true,
          no_intra_emphasis: true,
          autolink: true,
          strikethrough: true,
          lax_html_blocks: true,
          superscript: true
      }
      markdown_to_html = Redcarpet::Markdown.new(coderayified, options)
      markdown_to_html.render(text).html_safe
  end

  def markdown_json(json_text)
    pretty_json = JSON.pretty_generate JSON.parse(json_text)
    markdown("```json\n#{pretty_json}")
  end

end

{'fraction_non_alphanumeric': 0.11243484735666419, 'fraction_numerical': 0.005956813104988831, 'mean_word_length': 2.939882697947214, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, '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': '907309', 'n_tokens_mistral': 902, 'n_tokens_neox': 865, 'n_words': 150}