From 0b745c25e456dc0be2ef5d32a57e083d722ac350 Mon Sep 17 00:00:00 2001 From: Stephan Hradek Date: Tue, 3 Jan 2023 18:53:20 +0100 Subject: [PATCH] This should fix #171 by allowing a markdown link to start with ac: (#222) --- README.md | 8 ++++++++ pkg/mark/markdown.go | 15 +++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/README.md b/README.md index 99cb3dbc..83cca549 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/pkg/mark/markdown.go b/pkg/mark/markdown.go index 06c2128e..85b060b3 100644 --- a/pkg/mark/markdown.go +++ b/pkg/mark/markdown.go @@ -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("")) + return bf.SkipChildren + } + return bf.GoToNext + } return renderer.Renderer.RenderNode(writer, node, entering) }