forked from forgejo/forgejo
Make cross-reference issue links work in markdown documents again (#28682)
In #26365 issue references were disabled entirely for documents, intending to match GitHub behavior. However cross-references do appear to work in documents on GitHub. This is useful for example to write release notes in a markdown document and reference issues. While the simpler syntax may create links when not intended, hopefully the cross-reference syntax is unique enough to avoid it.
This commit is contained in:
parent
91aa263225
commit
12c0487e01
3 changed files with 18 additions and 7 deletions
|
@ -331,8 +331,11 @@ func FindAllIssueReferences(content string) []IssueReference {
|
|||
}
|
||||
|
||||
// FindRenderizableReferenceNumeric returns the first unvalidated reference found in a string.
|
||||
func FindRenderizableReferenceNumeric(content string, prOnly bool) (bool, *RenderizableReference) {
|
||||
match := issueNumericPattern.FindStringSubmatchIndex(content)
|
||||
func FindRenderizableReferenceNumeric(content string, prOnly, crossLinkOnly bool) (bool, *RenderizableReference) {
|
||||
var match []int
|
||||
if !crossLinkOnly {
|
||||
match = issueNumericPattern.FindStringSubmatchIndex(content)
|
||||
}
|
||||
if match == nil {
|
||||
if match = crossReferenceIssueNumericPattern.FindStringSubmatchIndex(content); match == nil {
|
||||
return false, nil
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue