Skip to content

Commit

Permalink
Merge pull request rtomayko#47 from defunkt/process-markdown
Browse files Browse the repository at this point in the history
Split Markdown processing into its own method
  • Loading branch information
rtomayko committed May 31, 2011
2 parents 7ba75f0 + c4da544 commit d149a9b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/rocco.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit d149a9b

Please sign in to comment.