Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Replace an URL with Macro after inserting it in Confluence

Martin Böhme
Community Champion
August 27, 2018

When you insert a YouTube URL to a confluence page, it gets replaced by the YouTube macro within a second. Also, the URL will be but as paramter of the macro.

When you insert a Jira URL (of a application linked Jira), it gets replaced by the Jira macro within a second. Also, the parameters are set automatically.

 

How can I achieve this with my own User Macro?

I want a specifiy URL (linke https://foo.net/bar) to always get transformed to my Foo macro.

1 answer

1 vote
Gregor Kasmann_Actonic
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 27, 2018

We've investigated it previously and looks like it is implemented not by macros, but by Confluence editor, which based on TinyMCE. So the editor has some predefined hooks on text insert and replaces some text patterns to macros on the fly.
We've found a workaround with a custom event listener for "Page Created" and "Page Updated" events which replaces our URL patterns to macros. Of course, a user will not see the changes right after inserting some text but the proper macro will be on a page after saving.

Martin Böhme
Community Champion
August 27, 2018

Thanks for the answer, Gergor!

Unfortunately, this workaround is not a real nice solution :/

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events