Skip to content

Commit

Permalink
This should fix #171 by allowing a markdown link to start with ac: (#222
Browse files Browse the repository at this point in the history
)
  • Loading branch information
Skeeve authored Jan 3, 2023
1 parent 55b58bd commit 0b745c2
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,14 @@ You can use various [parameters](https://confluence.atlassian.com/conf59/childre
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

### Homebrew
Expand Down
15 changes: 15 additions & 0 deletions pkg/mark/markdown.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,21 @@ func (renderer ConfluenceRenderer) RenderNode(

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)
}

Expand Down

0 comments on commit 0b745c2

Please sign in to comment.