mobtvse icon indicating copy to clipboard operation
mobtvse copied to clipboard

Code Blocks with Syntax Highlighting

Open stephenjamieson opened this issue 12 years ago • 1 comments

I possible it would be great to have Syntax Highlighting for code blocks such as github accomplishes with ```

example:

var = what
$what = "2"

stephenjamieson avatar Aug 29 '12 16:08 stephenjamieson

I love this idea, and there are a number of good libraries to handle it. Octopress, for example uses pygments.rb, and there are JavaScript only libraries which might be a good choice too

But here's the question that's left me without adding it yet:

What's the best way to implement language specific syntax highlighting without creating something that isn't Markdown, or Multimarkdown?

I think the syntax Octopress is currently going with is best I've seen

``` [language] [title] [url] [link text]
code snippet
```

They used to use something that involved curly braces and made your posts decidedly not markdown, so I didn't realize someone had come up with a more markdownish variant.

I think we should probably borrow Octopress's implementation for this, but the extra time required to process this (not that its huge) makes me think we should probably pre-compile the HTML for each post's content and start using that when rendering the pages. In the end we'd get the syntax highlighting and faster page loads.

masukomi avatar Aug 31 '12 12:08 masukomi