Skip to content

Commit

Permalink
Close sirthias#21
Browse files Browse the repository at this point in the history
  • Loading branch information
sirthias committed Jul 5, 2011
1 parent 4ddd146 commit d28364d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/main/java/org/pegdown/ToHtmlSerializer.java
Original file line number Diff line number Diff line change
Expand Up @@ -302,12 +302,18 @@ public void visit(TableRowNode node) {
public void visit(VerbatimNode node) {
printer.println().print("<pre><code>");
String text = node.getText();
text = transformVerbatimText(text);
printer.printEncoded(text, this);
printer.print("</code></pre>");
}

public String transformVerbatimText(String text) {
// transform all initial newlines to HTML breaks
while(text.charAt(0) == '\n') {
printer.print("<br/>");
text = text.substring(1);
}
printer.printEncoded(text, this);
printer.print("</code></pre>");
return text;
}

public void visit(TextNode node) {
Expand Down

0 comments on commit d28364d

Please sign in to comment.