mirror of
https://github.com/go-gitea/gitea.git
synced 2026-08-10 05:24:18 +09:00
enhance(markup): improve issue title rendering (#37908)
This commit is contained in:
@@ -69,6 +69,11 @@ func emojiShortCodeProcessor(ctx *RenderContext, node *html.Node) {
|
||||
m[1] += start
|
||||
start = m[1]
|
||||
|
||||
// don't render a shortcode whose ":" directly follows a backtick (an unclosed code span)
|
||||
if m[0] > 0 && node.Data[m[0]-1] == '`' {
|
||||
continue
|
||||
}
|
||||
|
||||
alias := node.Data[m[0]:m[1]]
|
||||
|
||||
var nextChar byte
|
||||
|
||||
@@ -377,6 +377,9 @@ func TestRender_emoji(t *testing.T) {
|
||||
test(":100:200", `<p>:100:200</p>`)
|
||||
test("std::thread::something", `<p>std::thread::something</p>`)
|
||||
test(":not exist:", `<p>:not exist:</p>`)
|
||||
test("foo `:smile:", "<p>foo `:smile:</p>")
|
||||
test("foo `:smile:`", `<p>foo <code>:smile:</code></p>`)
|
||||
test("foo ` :smile:", "<p>foo ` <span class=\"emoji\" aria-label=\"grinning face with smiling eyes\">😄</span></p>")
|
||||
}
|
||||
|
||||
func TestRender_ShortLinks(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user