How to escape Javascript in User macro

stm32 arm 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

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events