diff --git a/src/main/scala/gitbucket/core/view/Markdown.scala b/src/main/scala/gitbucket/core/view/Markdown.scala
index 06ba37c..03e1eff 100644
--- a/src/main/scala/gitbucket/core/view/Markdown.scala
+++ b/src/main/scala/gitbucket/core/view/Markdown.scala
@@ -57,6 +57,29 @@
(if(escaped) code else escape(code, true)) + ""
}
+ override def list(body: String, ordered: Boolean): String = {
+ var listType: String = null
+ if (ordered) {
+ listType = "ol"
+ }
+ else {
+ listType = "ul"
+ }
+ if(body.contains("""class="task-list-item-checkbox"""")){
+ return "<" + listType + " class=\"task-list\">\n" + body + "" + listType + ">\n"
+ } else {
+ return "<" + listType + ">\n" + body + "" + listType + ">\n"
+ }
+ }
+
+ override def listitem(text: String): String = {
+ if(text.contains("""class="task-list-item-checkbox" """)){
+ return "
" + text + ""
+ } else {
+ return "" + text + ""
+ }
+ }
+
override def text(text: String): String = {
// convert commit id and username to link.
val t1 = if(enableRefsLink) convertRefsLinks(text, repository, "issue:") else text
@@ -72,7 +95,7 @@
}
override def nolink(text: String): String = {
- if(enableWikiLink && text.startsWith("[") && text.endsWith("]")){
+ if(enableWikiLink && text.startsWith("[[") && text.endsWith("]]")){
val link = text.replaceAll("(^\\[\\[|\\]\\]$)", "")
val (label, page) = if(link.contains('|')){
@@ -84,9 +107,9 @@
val url = repository.httpUrl.replaceFirst("/git/", "/").stripSuffix(".git") + "/wiki/" + StringUtil.urlEncode(page)
if(pages.contains(page)){
- "" + escape(page) + ""
+ "" + escape(label) + ""
} else {
- "" + escape(page) + ""
+ "" + escape(label) + ""
}
} else {
escape(text)
@@ -161,20 +184,6 @@
// printer.print(s"$tag>")
// }
//
-// override def visit(node: TextNode): Unit = {
-// // convert commit id and username to link.
-// val t = if(enableRefsLink) convertRefsLinks(node.getText, repository, "issue:") else node.getText
-//
-// // convert task list to checkbox.
-// val text = if(enableTaskList) GitBucketHtmlSerializer.convertCheckBox(t, hasWritePermission) else t
-//
-// if (abbreviations.isEmpty) {
-// printer.print(text)
-// } else {
-// printWithAbbreviations(text)
-// }
-// }
-//
// override def visit(node: VerbatimNode) {
// val printer = new Printer()
// val serializer = verbatimSerializers.get(VerbatimSerializer.DEFAULT)
@@ -186,28 +195,6 @@
//
// this.printer.print(t)
// }
-//
-// override def visit(node: BulletListNode): Unit = {
-// if (printChildrenToString(node).contains("""class="task-list-item-checkbox" """)) {
-// printer.println().print("""""").indent(+2)
-// visitChildren(node)
-// printer.indent(-2).println().print("
")
-// } else {
-// printIndentedTag(node, "ul")
-// }
-// }
-//
-// override def visit(node: ListItemNode): Unit = {
-// if (printChildrenToString(node).contains("""class="task-list-item-checkbox" """)) {
-// printer.println()
-// printer.print("""""")
-// visitChildren(node)
-// printer.print("")
-// } else {
-// printer.println()
-// printTag(node, "li")
-// }
-// }
//}
object GitBucketHtmlSerializer {