Forums

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

Change code snippet with variable of language

Steffen Gosling
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!
March 21, 2022

I'm creating a template which people are going to use to document processes.

I want them to be able to select a programming language and a code snippet below it to change depending on which language is selected

The closest I have come is the variable function, but I haven't been able to change other items depending on what that variable is.

1 answer

0 votes
Andy Gladstone
Community Champion
March 21, 2022

@Steffen Gosling Welcome to Confluence Cloud!

Perhaps I am not understanding the question. Why can't you just use the /code macro and select the language you want the snippet to format as, likCapture211.JPGe in the picture below?

Steffen Gosling
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!
March 22, 2022

I am making a template

I want to change parts of the page depending on what variable is chosen (which programming language) not the language of the snippet

For example, the user chooses programming_language_1 as the variable value, and a portion of code beneath changes to give a process in the given language

Andy Gladstone
Community Champion
March 22, 2022

@Steffen Gosling I am not familiar enough with dependent variables (If x then y) to answer. Hopefully someone else from the community can!

Like Steffen Gosling likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events