mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-08 06:25:51 +01:00
(refs #231)Fix anchor icon style and apply URL encoding to non-ascii chars in anchor name.
This commit is contained in:
@@ -143,12 +143,10 @@ object GitBucketHtmlSerializer {
|
|||||||
|
|
||||||
private val Whitespace = "[\\s]".r
|
private val Whitespace = "[\\s]".r
|
||||||
|
|
||||||
private val SpecialChars = "[^\\w-]".r
|
|
||||||
|
|
||||||
def generateAnchorName(text: String): String = {
|
def generateAnchorName(text: String): String = {
|
||||||
val noWhitespace = Whitespace.replaceAllIn(text, "-")
|
val noWhitespace = Whitespace.replaceAllIn(text, "-")
|
||||||
val normalized = Normalizer.normalize(noWhitespace, Normalizer.Form.NFD)
|
val normalized = Normalizer.normalize(noWhitespace, Normalizer.Form.NFD)
|
||||||
val noSpecialChars = SpecialChars.replaceAllIn(normalized, "")
|
val noSpecialChars = StringUtil.urlEncode(normalized)
|
||||||
noSpecialChars.toLowerCase(Locale.ENGLISH)
|
noSpecialChars.toLowerCase(Locale.ENGLISH)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -857,7 +857,6 @@ div.markdown-body table colgroup + tbody tr:first-child td:last-child {
|
|||||||
|
|
||||||
a.markdown-anchor-link {
|
a.markdown-anchor-link {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 16px;
|
|
||||||
left: -20px;
|
left: -20px;
|
||||||
width: 32px;
|
width: 32px;
|
||||||
height: 16px;
|
height: 16px;
|
||||||
@@ -865,3 +864,7 @@ a.markdown-anchor-link {
|
|||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
h1 a.markdown-anchor-link, h2 a.markdown-anchor-link, h3 a.markdown-anchor-link {
|
||||||
|
top: 10px;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user