mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-23 06:43:34 +01:00
Merge pull request '[v9.0/forgejo] fix: remove softbreak from github legacy callout' (#6155) from bp-v9.0/forgejo-216a542 into v9.0/forgejo
Some checks are pending
/ release (push) Waiting to run
testing / frontend-checks (push) Waiting to run
testing / test-unit (push) Blocked by required conditions
testing / test-remote-cacher (map[image:docker.io/bitnami/redis:7.2 port:6379]) (push) Blocked by required conditions
testing / test-remote-cacher (map[image:docker.io/bitnami/valkey:7.2 port:6379]) (push) Blocked by required conditions
testing / test-remote-cacher (map[image:ghcr.io/microsoft/garnet-alpine:1.0.14 port:6379]) (push) Blocked by required conditions
testing / backend-checks (push) Waiting to run
testing / test-remote-cacher (map[image:registry.redict.io/redict:7.3.0-scratch port:6379]) (push) Blocked by required conditions
testing / test-mysql (push) Blocked by required conditions
testing / test-pgsql (push) Blocked by required conditions
testing / test-sqlite (push) Blocked by required conditions
testing / security-check (push) Blocked by required conditions
Some checks are pending
/ release (push) Waiting to run
testing / frontend-checks (push) Waiting to run
testing / test-unit (push) Blocked by required conditions
testing / test-remote-cacher (map[image:docker.io/bitnami/redis:7.2 port:6379]) (push) Blocked by required conditions
testing / test-remote-cacher (map[image:docker.io/bitnami/valkey:7.2 port:6379]) (push) Blocked by required conditions
testing / test-remote-cacher (map[image:ghcr.io/microsoft/garnet-alpine:1.0.14 port:6379]) (push) Blocked by required conditions
testing / backend-checks (push) Waiting to run
testing / test-remote-cacher (map[image:registry.redict.io/redict:7.3.0-scratch port:6379]) (push) Blocked by required conditions
testing / test-mysql (push) Blocked by required conditions
testing / test-pgsql (push) Blocked by required conditions
testing / test-sqlite (push) Blocked by required conditions
testing / security-check (push) Blocked by required conditions
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6155 Reviewed-by: Otto <otto@codeberg.org>
This commit is contained in:
commit
8fa76300ae
2 changed files with 14 additions and 0 deletions
|
@ -63,6 +63,14 @@ func (g *GitHubLegacyCalloutTransformer) Transform(node *ast.Document, reader te
|
|||
attentionParagraph.AppendChild(attentionParagraph, calloutNode)
|
||||
firstParagraph.Parent().InsertBefore(firstParagraph.Parent(), firstParagraph, attentionParagraph)
|
||||
firstParagraph.RemoveChild(firstParagraph, calloutNode)
|
||||
|
||||
// Remove softbreak line if there's one.
|
||||
if firstParagraph.ChildCount() >= 1 {
|
||||
softBreakNode, ok := firstParagraph.FirstChild().(*ast.Text)
|
||||
if ok && softBreakNode.SoftLineBreak() {
|
||||
firstParagraph.RemoveChild(firstParagraph, softBreakNode)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ast.WalkContinue, nil
|
||||
|
|
|
@ -1356,4 +1356,10 @@ func TestCallout(t *testing.T) {
|
|||
}
|
||||
|
||||
test(">\n0", "<blockquote>\n</blockquote>\n<p>0</p>")
|
||||
test("> **Warning**\n> Bad stuff is brewing here", `<blockquote class="attention-header attention-warning"><p class="attention-title"><strong class="attention-warning">Warning</strong></p>
|
||||
<p>Bad stuff is brewing here</p>
|
||||
</blockquote>`)
|
||||
test("> [!WARNING]\n> Bad stuff is brewing here", `<blockquote class="attention-header attention-warning"><p class="attention-title"><strong class="attention-warning">Warning</strong></p>
|
||||
<p>Bad stuff is brewing here</p>
|
||||
</blockquote>`)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue