Question

I just add a sbt dependency to my Play 2 project:

val appDependencies = Seq(
   "org.markdownj" % "markdownj" % "0.3.0-1.0.2b4"    
)

How can I now use this library in my controllers & models in Play 2. I just can't figure it out!

Was it helpful?

Solution

Usage in templates:

@Html(new com.petebevin.markdown.MarkdownProcessor().markdown("This is a *simple* test."))

Usage in a controller/model:

import com.petebevin.markdown.MarkdownProcessor
val textInMarkdown = /* where ever your text comes from */
val htmlCode: String = new MarkdownProcessor().markdown(textInMarkdown)

May be it is helpful to generate javadocs (bash):

git clone https://github.com/myabc/markdownj.git
cd markdownj/core
mvn javadoc:javadoc #this may take a while, loading lots of dependencies
#open markdownj/core/target/site/apidocs/index.html

Be open for other markdown processors.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top