• Jon Fisher
    Jon Fisher, 2009/10/28 22:48

    How do you change the coloring styles? The defaults are pretty ugly and make reading java code a chore. Inspecting the HTML reveals the codemacro is using inline styles and not stylesheets... is there a way to change that?

    • Dave Newton
      Dave Newton, 2009/12/10 19:49

      I changed the collibri CSS file, there are .code (and .box) styles used to demark code blocks. I modified those to shrink the font, use a monospaced font, and added a separate .code style to add a bit of padding to the box.

    • Thomas Mortagne
      Thomas Mortagne, 2009/12/11 10:51

      Code macro use inline style only for colors, general font style is done at .code CSS class level

  • Roman Muntyanu
    Roman Muntyanu, 2010/03/17 09:37

    How to configure code colouring style

    One can choose one of the numerous styles that come with pygmets. To configure highlighting style, first stop XWiki server.

    Then modify file /pygments/styles/colorful.py/pygments/styles/__init__.py in the %XWikiHome%/webapps/xwiki/WEB-INF/lib/pygments-<version.numbers>-xwiki.jar.

    Change the STYLE_MAP variable's 'default' key's value.

    #: Maps style names to 'submodule::classname'.
    STYLE_MAP = {
        'default':  'default::DefaultStyle',
        'emacs':    'emacs::EmacsStyle',
        'friendly': 'friendly::FriendlyStyle',
        'colorful': 'colorful::ColorfulStyle',
        'autumn':   'autumn::AutumnStyle',
        'murphy':   'murphy::MurphyStyle',
    ...
        'tango':    'tango::TangoStyle',
    }

    to one of the available styles. E.g. 'colorful'. So the change will look like 

    STYLE_MAP = {
        'default':  'friendly::FriendlyStyle',
    ...
    }

    Save the __init__.py file in the pygments-<version.numbers>-xwiki.jar package. 

    Start the server and verify that colour style has updated.

    By adding your own file to /pygments/styles/colorful.py/pygments/styles folder of the pygments-<version.numbers>-xwiki.jar package and registering it in the STYLE_MAP variable, you will be able to configure your own code colouring styles.
    • Thomas Mortagne
      Thomas Mortagne, 2010/05/06 13:54

      Since 2.4M1 it's easily configurable in xwiki.properties files:

      rendering.macro.code.pygments.style=friendly
  • Pavel D.
    Pavel D., 2015/03/10 09:37

    Where can I find the syntax for specifying all supported languages - XY in code language = XY? Right now, I want to use syntax highlighting in xwiki for VB.net, but I was not able to find any resource that would tell me what code XY would be for Visual Basic. It should be supported according to http://pygments.org/languages

  • Pavel D.
    Pavel D., 2015/03/10 10:37

    In the end, vbnet seems to do the trick for VB.net code. I'd still be interested to know all available languages names that can be used in the macro

  • Mirko Schaal
    Mirko Schaal, 2016/12/09 15:57

    Is there a way to set the "startinline" Option of Pygments PHP Lexer?
    See http://pygments.org/docs/lexers/#lexers-for-php-and-related-languages for details.

Get Connected