This should fix #171 by allowing a markdown link to start with ac: (#222)

This commit is contained in:
Stephan Hradek 2023-01-03 18:53:20 +01:00 committed by GitHub
parent 55b58bd59b
commit 0b745c25e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 0 deletions

View File

@ -440,6 +440,14 @@ You can use various [parameters](https://confluence.atlassian.com/conf59/childre
See task MYJIRA-123. See task MYJIRA-123.
``` ```
### Insert link to existing confluence page by title
```markdown
This is a [link to an existing confluence page](ac:Pagetitle)
And this is how to link when the linktext is the same as the [Pagetitle](ac:)
```
## Installation ## Installation
### Homebrew ### Homebrew

View File

@ -73,6 +73,21 @@ func (renderer ConfluenceRenderer) RenderNode(
return bf.GoToNext return bf.GoToNext
} }
if node.Type == bf.Link && string(node.Destination[0:3]) == "ac:" {
if entering {
writer.Write([]byte("<ac:link><ri:page ri:content-title=\""))
if len(node.Destination) < 4 {
writer.Write(node.FirstChild.Literal)
} else {
writer.Write(node.Destination[3:])
}
writer.Write([]byte("\"/><ac:plain-text-link-body><![CDATA["))
writer.Write(node.FirstChild.Literal)
writer.Write([]byte("]]></ac:plain-text-link-body></ac:link>"))
return bf.SkipChildren
}
return bf.GoToNext
}
return renderer.Renderer.RenderNode(writer, node, entering) return renderer.Renderer.RenderNode(writer, node, entering)
} }