Languages list for Code Macro?

Hello,

I try to use Code Macro but I didn’t find any language code list.

What is the correct value for c# language ?

Where to find it ?

Thanks

Hello @NilkOne,

As you can read in the documentation:

See Languages — Pygments for the list of all supported languages. If you have a hard time finding the right id for the language, you can look at Available lexers — Pygments (Short names).

So if I trust Available lexers — Pygments, csharp, c#, and cs are all valid language identifiers for C# code.

If none of those values produces the expected results, your issue might have another cause.

If Python is an allowed script language you can do it automatically.

{{python}}
import pygments
from pygments.lexers import get_all_lexers


print "|=Language |=Name |=File Extension |=Mime Types"
for lexer in get_all_lexers():
    print "| ", lexer[0], " | ", ", ".join(lexer[1]), " | ", ", ".join(lexer[2]), " | ", ", ".join(lexer[3])

{{/python}}
1 Like

OK great thank you

Nice one :slight_smile: I’ve documented it at Code Macro (XWiki.org)