0

I want to colorize code snippet in markdown-mode.

# foo.rb
def foo
  do_something
end

And javascript code.

// bar.js
function bar(){
  do_something();
}

In markdown-mode the codes are colored by single color. Is there a way to colorize the codes by using proper programming language color mode?

I mean by reading first line of the codes like # foo.rb or // bar.js.

  • If you use the command M-x markdown-insert-gfm-code-block you will be prompted for a language and then you can enter a code block that I think is supposed to be highlighted based on language. I haven't gotten it to highlight quite right with my setup though, and will update or add an answer if I manage to get it to work right. But try that command and see how it works for you. – elethan Dec 27 '15 at 14:51
  • The command inserts three times back quote and name of the lang. yeah, this type of markdown works in some place. But I'm mainly using markdown in stakcexchange networks. Furthermore that is colorized only single color like when 4 times spaces are used. – ironsand Dec 27 '15 at 15:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.