Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,465,994
Community Members
 
Community Events
176
Community Groups

How do I add a custom theme to the code block macro?

I'm trying to extend the Code Block macro in Confluence to support a few new languages typically used on the mainframe (e.g., s/390 Assembler).  I have successfully added the new language following the instructions in Confluence and SyntaxHighlighter.  However, none of the existing color schemes are compatible with how I want the highlighting to look.  I see that SyntaxHighlighter also provides for developing custom color schemes.  How do I extend the available color scheme choices for Code Block sections in Confluence?

2 answers

1 vote
Shannon S Atlassian Team Jan 02, 2020

Hello Jim,

Welcome to Atlassian Community. It's nice to meet you!

It's not possible to customize the theme of the code block macro, but I've raised a feature request below for this:

In the meantime, you'll be able to use Marketplace add-ons to customize the theme of your code blocks:

Let me know if you have any questions about that.

Regards,

Shannon

Thanks for the reply.  Unfortunately, none of the plugins in the marketplace do what I need.  They don't support the languages I need.  

Shannon S Atlassian Team Jan 03, 2020

Hi Jim,

Thank you for letting me know. One of the add-ons for Cloud supports Assembly languages but not the ones for Server.

The custom brush syntax that you use has to adhere to Custom Brush Syntax, but it looks like you can include colors that way. Have you already tried calling the colors you need with CSS and that doesn't work?

Regards,

Shannon

Yes, after adding the custom brushes I've been playing around with the colors and available themes.  My goal is to make the code look like it does in the native z/OS terminal window since the code snippets we are documenting will be viewed by this set of developers.  None of the color choices get it right 100%.  

The SyntaxHighlighter on which the Code Block macro is based supports adding custom themes as well as custom brushes.  My suggestion (and what I believe you are saying in the ticket you opened) is to also expose this interface to anyone wishing to customize the macro.  I've added myself to the watch list for any future updates.  In the mean time I'm exploring writing my own macro for this purpose.

Thanks,

Jim

Shannon S Atlassian Team Jan 06, 2020

Hi Jim,

Yes, I'm sorry, I did mean via the UI, so I've updated the feature request to state this.

Good luck on working using the brush syntax. If you end up with anything you'd like to share, please feel free to share it here!

Regards,

Shannon

I have a similar requirement to replicate the highlighting color scheme from a UI that my users are accustomed to and have hit this same wall. 

It seems that in the years since this thread the links to the Custom Brush Syntax has gone dead and the brush files described in https://confluence.atlassian.com/doc/code-block-macro-139390.html

You can see examples in <install-directory>/confluence/includes/js/third-party.

are from a much older version of the library (1.5) than what is shipped with Confluence (3.0).  I managed to extract the actual brushes used by Confluence from the browser inspector which was extremely tedious. 

The SyntaxHighlighter library has moved on to v4 and is now at https://github.com/syntaxhighlighter/, documentation is still pretty sparse though. The library itself does support custom themes but not Atlassian.

It's just a CSS file

/* module-key = 'com.atlassian.confluence.ext.newcode-macro-plugin:sh-theme-confluence', location = 'sh/styles/shThemeConfluence.css' */

and I would be more than happy to just be able to upload my own css with the brush.  Icing on the cake would be the ability to specify a default theme per brush. 

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events