diff --git a/src/main/scala/view/helpers.scala b/src/main/scala/view/helpers.scala
index ad47676..2a3d888 100644
--- a/src/main/scala/view/helpers.scala
+++ b/src/main/scala/view/helpers.scala
@@ -25,44 +25,10 @@
value.replaceAll(" ", " ").replaceAll("\t", " ").replaceAll("\n", "
"))
/**
- * Converts the issue number and the commit id to the link.
- */
- private def markdownFilter(value: String, repository: service.RepositoryService.RepositoryInfo)(implicit context: app.Context): String = {
- value
- .replaceAll("#([0-9]+)", "[$0](%s/%s/%s/issue/$1)".format(context.path, repository.owner, repository.name))
- .replaceAll("[0-9a-f]{40}", "[$0](%s/%s/%s/commit/$0)".format(context.path, repository.owner, repository.name))
- }
-
- /**
* Converts Markdown of Wiki pages to HTML.
*/
def markdown(value: String, repository: service.RepositoryService.RepositoryInfo, wikiLink: Boolean)(implicit context: app.Context): twirl.api.Html = {
- import org.pegdown._
- val html = new PegDownProcessor(Extensions.AUTOLINKS|Extensions.WIKILINKS|Extensions.FENCED_CODE_BLOCKS)
- .markdownToHtml(markdownFilter(value, repository), new LinkRenderer(){
- override def render(node: WikiLinkNode): Rendering = {
- if(wikiLink){
- super.render(node)
- } else {
- try {
- val text = node.getText
- val (label, page) = if(text.contains('|')){
- val i = text.indexOf('|')
- (text.substring(0, i), text.substring(i + 1))
- } else {
- (text, text)
- }
- val url = "%s/%s/%s/wiki/%s".format(context.path, repository.owner, repository.name,
- java.net.URLEncoder.encode(page.replace(' ', '-'), "UTF-8"))
- new Rendering(url, label);
- } catch {
- case e: java.io.UnsupportedEncodingException => throw new IllegalStateException();
- }
- }
- }
- })
-
- Html(html)
+ Html(Markdown.toHtml(value, repository, wikiLink))
}
/**
diff --git a/src/main/twirl/preview.scala.html b/src/main/twirl/preview.scala.html
index a434d33..58c7072 100644
--- a/src/main/twirl/preview.scala.html
+++ b/src/main/twirl/preview.scala.html
@@ -16,6 +16,8 @@
+
+
+