The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

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

How to escape Javascript in User macro

stm32 arm
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 3, 2019

Hi.

I'm trying to run Javascript app in a Confluence page*. When I wrote the app in the HTML macro, the  Javascript app seemed to be running as intended like shown below. (It's just an Angular8 sample project)

angular.png

However, when I wrote same app in the User macro, Velocity Template Engine(VTE) parses the app and throws error "Error occured rendering template content".

[User-macro] -> Error occured rendering template content
## @noparams
<script type="text/javascript">
...copy & paste the app code... <-- parsed by Velocity Template Engine
</script>

error.png

To prevent VTL parsing the app, I tried to escape the code with #[[don't parse me!]]# syntax (supported VTE 1.6 or higher) explained in "VTE user manual". But it seems #[[don't parse me!]]# syntax isn't suppoted in Confluence.

[User-macro] -> Error occured rendering template content
## @noparams
#[[
#foreach ($woogie in $boogie)
nothing will happen to $woogie
#end
]]#

Does anyone know how to escape Javascript in User macro? Or is there any way to run Javascript app in the Confluence page?

* Our server administrators said, they can't allow general users to install a plugin to add Web resources or configuring Custom HTML to add <script> tag to <head>. They can only allow general users to add User macros or HTML macros.

0 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

TAGS
AUG Leaders

Atlassian Community Events