Blog should do Syntax Highlighting on specific blocks #193

Closed
robyurkowski opened this Issue Feb 5, 2012 · 3 comments

Comments

Projects
None yet
4 participants
@robyurkowski
Contributor

robyurkowski commented Feb 5, 2012

If we want to increase adoption amongst programmers (our biggest evangelists), it would make sense to have an in-box solution to do some syntax highlighting in the blog module.

@simi suggested using something like this: http://google-code-prettify.googlecode.com/svn/trunk/README.html

@joemsak

This comment has been minimized.

Show comment
Hide comment
@joemsak

joemsak Mar 26, 2012

Contributor

In our blog, I monkey patched it to pick up this convention:

[gist:567469]

in the text and re-format it into a < script /> include of the gist... (the URLs follow the same pattern with the ID.js)

<%= @blog_post.gsub(/\[gist:(\d*)\]/,"<script src='http://gist.github.com/\1.js'></script>") %>

Would that work? Obviously we could make it more sophisticated

Otherwise, we could try to go the github way of surrounding in ```

def highlight(blog_post_body)
  to_highlight = blog_post_body.match() #=> some regex match for ```#{formatter}\n<code>\n```
  to_highlight.formatter #=> :ruby
  to_highlight.format_as(to_highlight.formatter)
end
Contributor

joemsak commented Mar 26, 2012

In our blog, I monkey patched it to pick up this convention:

[gist:567469]

in the text and re-format it into a < script /> include of the gist... (the URLs follow the same pattern with the ID.js)

<%= @blog_post.gsub(/\[gist:(\d*)\]/,"<script src='http://gist.github.com/\1.js'></script>") %>

Would that work? Obviously we could make it more sophisticated

Otherwise, we could try to go the github way of surrounding in ```

def highlight(blog_post_body)
  to_highlight = blog_post_body.match() #=> some regex match for ```#{formatter}\n<code>\n```
  to_highlight.formatter #=> :ruby
  to_highlight.format_as(to_highlight.formatter)
end
@phiggins

This comment has been minimized.

Show comment
Hide comment
@phiggins

phiggins Mar 27, 2012

Contributor

I was just pointed at this client-side highlighter today: http://craig.is/making/rainbows

Contributor

phiggins commented Mar 27, 2012

I was just pointed at this client-side highlighter today: http://craig.is/making/rainbows

@parndt

This comment has been minimized.

Show comment
Hide comment
@parndt

parndt Dec 4, 2012

Member

Stale! If anyone wants to pull request please do

Member

parndt commented Dec 4, 2012

Stale! If anyone wants to pull request please do

@parndt parndt closed this Dec 4, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment