Skip to Content

A very long time ago we implemented a “snippet gallery” within the wiki. The idea was to create one of the most comprehensive collections of code snippets, code samples and tutorials that ever existed for the SAP ecosystem.

Today I want to ask each of you to do your part to achieve that goal. From now on when you are writing a forum message or a weblog that will have “code” PLEASE jump over here and add the snippet here first and then link to it. Or even drag this bookmarklet up to your browser toolbar (or create a new bookmark in your tool bar with the following: 

javascript:location.href=’https://wiki.sdn.sap.com/wiki/pages/createpage.action?spaceKey=Snippets&fromPageId=9055′;

There’s a very simple reason for this, actually a couple of them.

  1. Easier readability
  2. Easier searching (remember to use the labels on your page)
  3. Syntax Highlighting
  4. Syntax Highlighting – wait did I mention that already?

We have implemented a brand new feature into the wiki for code, for those who have been in the community for the past several years you’ll recognize this I think 😉 it took us awhile but it’s finally here!

Here’s the “before”

and now the “after”

 

Usage:

{highlighter: language}

..code…

{highlighter}

Bash/shell:      bash
C#:      c-sharp
C++:      cpp
CSS:      css      
Delphi:      delphi
Groovy:      groovy
JavaScript:      jscript
Java:      java      
PHP:      php
Plain Text:       ( nothing)
Python:      python
Ruby:      ruby
Scala:      scala
SQL:      sql
Visual Basic:      vb
XML:      xml 

Anyone up for creating some SAP specific ones? We based this macro off of this.

To report this post you need to login first.

6 Comments

You must be Logged on to comment or reply to a post.

    1. Richard Hirsch
      I remember you guys working on ABAP syntax formatting for another system (GoogleCode?) at a past TechEd. Maybe you can re-use the code.

      D.

      (0) 
  1. Ankan Banerjee
    This is really great! 🙂
    Craig, anyway you can make the code snippets inserted in new posts automatically add to the snippet gallery instead of having the user to do this? I guess we’ll end up filling the gallery much faster that way – may have something like a checkbox for auto-posting to the snippet gallery when a user is making a forum post…
    (0) 
  2. Alvaro Tejada Galindo
    Great!

    Now I have a nice job to spend my weekend -:) With the Scripting languages I have wrote in my blogs, I’m going to spend a lot of my weekend time adding the to the new Code Gallery -;)

    Greetings,
    Blag.

    (0) 

Leave a Reply