10

Does anyone know of any C# syntax highlighter plugins for Confluence? Using the default Java highlighter works, but it misses things like string in C# and String in Java, with the latter being highlighted and the former plain black text.

Andrew Bienert
  • 348
  • 2
  • 8

1 Answers1

13

There is a so called newcode macro that allows a lot of different languages. See https://studio.plugins.atlassian.com/wiki/display/NCODE/Confluence+New+Code+Macro for the macro itself.

To use the macro, just enclose your code into

{newcode:csharp}...{newcode}

With newer versions of this macro (or newer versions of Confluence itself), you are free to use the macro name newcode or code. Since version 4.x of Confluence, the visual editor supports the finding of macros much better, so just start typing: {code which results then in

enter image description here

In the then opening macro editor, you may select directly the language (and some other parameters):

enter image description here

mliebelt
  • 15,345
  • 7
  • 55
  • 92
  • 1
    I had to use `{code:lang-csharp}` to specify the language. I think newer versions of the newcode macro support `{code}` or `{newcode}`. – Adam Caviness Jun 13 '12 at 14:18
  • I was able to start typing `{code`, and once I chose `Code Block` from the autocomplete list, I was able to click on it to create it, and then click `Edit` to get to the macro editor described above. – Darth Continent Mar 19 '14 at 15:41