Skip navigation
This discussion is archived

displaying code in a wiki

3238 Views 3 Replies Latest reply: Jan 28, 2010 9:12 AM by giezi RSS
plg Level 1 Level 1 (0 points)
Currently Being Moderated
Oct 5, 2009 1:14 PM
Does anyone know if there is a convenient way of displaying source code on a wiki page? Sure, I can select the text and make it monospace, then manually fix the spacing, etc... but is there a magic button to press or magic html tags to put in so that a block of source code shows nicely on my wiki page? (e.g. a series of unix commands, or a block of C code)?
  • Pope7 Calculating status...
    Currently Being Moderated
    Oct 29, 2009 10:01 AM (in response to plg)
    You can create a whitelist.plist file and place it in /etc/wikid/ which will allow you to specifically define html tags allowed on wiki pages. Then you can just add your custom CSS to the blocks of code you want to style. The first link below is a decent example. Also, if you go to /library/application support/apple/wikiserver/themes/directoryof_them_youuse/ you can edit the css for each theme - you could just edit the css for one of the existing styles defined in those stylesheets.

    (See and
    Two XServes, Mac OS X (10.6.1)
  • jwdavidson Calculating status...
    Currently Being Moderated
    Nov 1, 2009 1:00 PM (in response to plg)
    I have been working on a solution to displaying properly formatted and colorized code in the wiki. I am using a javascript and css from

    So far it I have modified the tags in whitelist.plist so that it accepts the 'lang' attribute on the <pre> tag. I have edited the css so that the codecolor.css is included in the theme I am using. I have modified the javascript so that there is an event that fires when the page loads in the wiki to add the formatting and color codes to the dom of the wiki text, and the code is displayed exactly as I want it.....

    That is, until I try to edit the page containing the code. What happens then is that the editor opens with the contents of the DOM, after formatting, rather than the raw wiki text that was stored and saved. Then the code becomes an absolute mess because the event that formats the code is fired a second time and makes an absolute mess of the html and the original wiki text with the embedded code.

    Is there anyway to have the editor load the saved wiki content rather than the unsaved DOM representation?

    John Davidson
    Mac Mini Server, Mac OS X (10.6.1)
  • giezi Calculating status...
    Currently Being Moderated
    Jan 28, 2010 9:12 AM (in response to jwdavidson)
    We have the excatly same problem like jwdavidson, if we edit a page with code highlighting.
    does anyone have a solution / workaround? Our implementation is based on

    Thanks and regards

    Message was edited by: giezi
    Mac OS X (10.6.2)


More Like This

  • Retrieving data ...

Bookmarked By (0)


  • This solved my question - 10 points
  • This helped me - 5 points
This site contains user submitted content, comments and opinions and is for informational purposes only. Apple disclaims any and all liability for the acts, omissions and conduct of any third parties in connection with or related to your use of the site. All postings and use of the content on this site are subject to the Apple Support Communities Terms of Use.