Permalink
Browse files

Merge pull request #47 from defunkt/process-markdown

Split Markdown processing into its own method
  • Loading branch information...
2 parents 7ba75f0 + c4da544 commit d149a9bbf497ebe000eeb51da749a9b9ab677d47 @rtomayko rtomayko committed May 31, 2011
Showing with 6 additions and 2 deletions.
  1. +6 −2 lib/rocco.rb
View
8 lib/rocco.rb
@@ -437,8 +437,7 @@ def highlight(blocks)
# dividers and run through the Markdown processor. Then split it back out
# into separate sections.
markdown = docs_blocks.join("\n\n##### DIVIDER\n\n")
- docs_html = Markdown.new(markdown, :smart).
- to_html.
+ docs_html = process_markdown(markdown).
split(/\n*<h5>DIVIDER<\/h5>\n*/m)
# Combine all code blocks into a single big stream with section dividers and
@@ -492,6 +491,11 @@ def highlight(blocks)
docs_html.zip(code_html)
end
+ # Convert Markdown to classy HTML.
+ def process_markdown(text)
+ Markdown.new(text, :smart).to_html
+ end
+
# We `popen` a read/write pygmentize process in the parent and
# then fork off a child process to write the input.
def highlight_pygmentize(code)

0 comments on commit d149a9b

Please sign in to comment.