Displaying code snippets in Sharepoint wiki

I found hilite.me which produces html styled code which you can insert into a sharpoint wiki.

It supports a number of languages and styles and is an online app.


No because MOSS's wiki is just a new page with the word "wiki" attached to the link.


Even though this is an old question, I have yet another solution that possibly didn't exist at the time the question was asked:

You can create a GitHub Gist and use the embed code for the Gist on the SharePoint wiki page. This is especially useful if you are already using Gist, want to share the code snippet in multiple places aside from the wiki, and/or want to keep a history of the code snippet separate from the rest of the wiki page.

To use an embed code without the script tags being stripped, go to Insert > Embed Code in the ribbon when editing the page:

Screenshot of Office 365 SharePoint insert ribbon


This solution assumes that you are using an IDE that already formats the code for you. Some of the other answers would be better if you have a raw text file.

While editing a Sharepoint Wiki page:

  1. Copy code from IDE to new MS Word doc
  2. Highlight all in MS Word: Ctrl+A
  3. Copy again inside MS Word
  4. Switch to wiki page, Paste
  5. Continue editing wiki or save

Works fine with Eclipse as IDE. Might be able to paste straight from VS to SharePoint.

If you have code snippets you will reuse in multiple pages, Use a similar copy/paste technique to save or upload htm files into a SharePoint document library and then insert a "Page Viewer Web Part" to view the htm inside a different page.