require 'exercism/markdown'
require 'loofah'

module ExercismWeb
  module Helpers
    module Markdown
      ROUGUE_LANG = {
        'objective-c' => 'objective_c',
        'elisp' => 'common_lisp',
        'plsql' => 'sql'
      }

      def md(text, language=nil)
        # HACK: Some languages have different names in Rouge
        language = ROUGUE_LANG[language] || language

        ConvertsMarkdownToHTML.convert(language ? "```#{language}\n#{text}\n```" : text)
      end
    end
  end
end

require 'exercism/markdown'
require 'loofah'

module ExercismWeb
  module Helpers
    module Markdown
      ROUGUE_LANG = {
        'objective-c' => 'objective_c',
        'elisp' => 'common_lisp',
        'plsql' => 'sql',
        'ecmascript' => 'javascript',
      }

      def md(text, language=nil)
        # HACK: Some languages have different names in Rouge
        language = ROUGUE_LANG[language] || language

        ConvertsMarkdownToHTML.convert(language ? "```#{language}\n#{text}\n```" : text)
      end
    end
  end
end

Fix missing syntax highlighting for ecmascript
Fix missing syntax highlighting for ecmascript

The rouge gem doesn't recognize ecmascript as a language,
this adds a hack so that it considers ecmascript as javascript.

Fixes exercism/xecmascript#34
