mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-15 18:05:50 +01:00
(refs #1031)Fix issue link processing in Markdown
This commit is contained in:
@@ -33,13 +33,9 @@ object Markdown {
|
|||||||
enableTaskList: Boolean = false,
|
enableTaskList: Boolean = false,
|
||||||
hasWritePermission: Boolean = false,
|
hasWritePermission: Boolean = false,
|
||||||
pages: List[String] = Nil)(implicit context: Context): String = {
|
pages: List[String] = Nil)(implicit context: Context): String = {
|
||||||
// escape issue id
|
|
||||||
val s = if(enableRefsLink){
|
|
||||||
markdown.replaceAll("(?<=(\\W|^))#(\\d+)(?=(\\W|$))", "issue:$2")
|
|
||||||
} else markdown
|
|
||||||
|
|
||||||
// escape task list
|
// escape task list
|
||||||
val source = if(enableTaskList) escapeTaskList(s) else s
|
val source = if(enableTaskList) escapeTaskList(markdown) else markdown
|
||||||
|
|
||||||
val options = new Options()
|
val options = new Options()
|
||||||
options.setSanitize(true)
|
options.setSanitize(true)
|
||||||
@@ -112,7 +108,7 @@ object Markdown {
|
|||||||
|
|
||||||
override def text(text: String): String = {
|
override def text(text: String): String = {
|
||||||
// convert commit id and username to link.
|
// convert commit id and username to link.
|
||||||
val t1 = if(enableRefsLink) convertRefsLinks(text, repository, "issue:", false) else text
|
val t1 = if(enableRefsLink) convertRefsLinks(text, repository, "#", false) else text
|
||||||
|
|
||||||
// convert task list to checkbox.
|
// convert task list to checkbox.
|
||||||
val t2 = if(enableTaskList) convertCheckBox(t1, hasWritePermission) else t1
|
val t2 = if(enableTaskList) convertCheckBox(t1, hasWritePermission) else t1
|
||||||
|
|||||||
Reference in New Issue
Block a user