diff --git a/src/main/scala/view/Markdown.scala b/src/main/scala/view/Markdown.scala
index e7fdf02..636d879 100644
--- a/src/main/scala/view/Markdown.scala
+++ b/src/main/scala/view/Markdown.scala
@@ -79,7 +79,7 @@
if(enableIssueLink){
// convert marked issue id to link.
html.replaceAll("#\\{\\{\\{\\{(\\d+)\\}\\}\\}\\}",
- "#$1".format(context.path, repository.owner, repository.name))
+ "#$1".format(context.path, repository.owner, repository.name))
} else html
}
@@ -106,14 +106,14 @@
override def visit(node: TextNode) {
// convert commit id to link.
- val text1 = if(enableCommitLink) node.getText.replaceAll("[0-9a-f]{40}",
- "$0".format(context.path, repository.owner, repository.name))
+ val text1 = if(enableCommitLink) node.getText.replaceAll("(^|\\W)([0-9a-f]{40})(\\W|$)",
+ "$2".format(context.path, repository.owner, repository.name))
else node.getText
// mark issue id to link
val startIndex = node.getStartIndex
val text2 = if(enableIssueLink && startIndex > 0 && markdown.charAt(startIndex - 1) == '#'){
- text1.replaceFirst("^(\\d+)", "{{{{$0}}}}")
+ text1.replaceFirst("^(\\d+)(\\W|$)", "{{{{$1}}}}")
} else text1
if (abbreviations.isEmpty) {