Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How do I paste a chunk of code?

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 Jan 04, 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 ?

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 Jan 04, 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.

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 Jan 05, 2022

Great, glad to help :)

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Confluence Cloud

🏠 Say hello to the new Confluence Home!

Hi Atlassian Community, My name is DJ Chung, and I’m a Product Manager on the Confluence Cloud team. Today, I’m excited to share a new and improved version of Home. The new Home helps you ...

987 views 7 42
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you