Skip to content

Instantly share code, notes, and snippets.

@erwan
Last active August 29, 2015 14:07
Show Gist options
  • Save erwan/a3924848b9b5f5d4e482 to your computer and use it in GitHub Desktop.
Save erwan/a3924848b9b5f5d4e482 to your computer and use it in GitHub Desktop.
val htmlSerializer = HtmlSerializer {
// Don't wrap images in a <p> tag
case (StructuredText.Block.Image(view, _, _), _) => s"${view.asHtml}"
// Add a class to em tags
case (em: Span.Em, content) => s"<em class='italic'>$content</em>"
}
val html = doc.getStructuredText("blog-post.body").map(_.asHtml(resolver, htmlSerializer))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment