How do I paste a chunk of code?

Alex Beamish January 4, 2022

We have a support schedule that shows who is on call, week by week.

This is handy for the Devs on call, and also for NOC, who can do a look up on this page and contact the appropriate person.

We've just moved from MediaWiki (which allowed us to build a table using wiki codes) to the Atlassian Confluence product (where that's not possible). That's OK, I figured out a workaround.

Now I'd like to include the script that generates the schedule on my page -- except specifying the 'code' format only last until the end of the line, which means when I paste my script, the first line of my script appears in code markup (yay) and then everything after that gets translated into Confluence code (boo).

How do I get Confluence to allow me to past an entire script as code?

1 answer

1 accepted

1 vote
Answer accepted
Kishan Sharma
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 4, 2022

Hi @Alex Beamish 

Have you tried Code snippet macro ? It lets you format source code with numbered rows and syntax highlighting based on the language you choose.

Type /code to quickly add this element from the slash command.

Shows a four lines of source code on numbered rows with a grey background

Let me know if that is what you are looking for ?

Alex Beamish January 4, 2022

Thanks for the suggestion. I'm not sure the version of the wiki that I have supports this feature. It doesn't have the markup feature (relevant to my first question here).

In a (possibly) unrelated development, the page that I was in the middle of editing suddenly changed to say "We can't show this page / The permissions for this page were changed. Contact an admin for help."

So I can't even try that now.

Kishan Sharma
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 4, 2022

Since you are using Cloud, the only difference could be Legacy Editor vs New editor. Refer this link to know which editor you are using.

Secondly, it seems like someone - possibly Author or the other user who have permissions to apply restrictions might have restricted edit access on the page you were editing, hence you got the error you mentioned. In that case you can contact the page author/ space admin to grant you the access.

Alex Beamish January 4, 2022

Thanks for your comments .. my installation does have the Code Snippet feature, and I was able to use that to add my script to the page. (This is accessible at the top right of the format bar -- click on the +V dropdown, select other and search for Code Snippet.)

I also solved my authentication issues, thanks to my excellent local Atlassian admin.

Like Kishan Sharma likes this
Kishan Sharma
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 5, 2022

Great, glad to help :)

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events