Help:Adding a new programming example: Difference between revisions

From Rosetta Code
Content added Content deleted
(Added to Adding Content category.)
(→‎Formatting: Added syntax highlighting mention.)
Line 12: Line 12:
==Formatting==
==Formatting==
Formatting a wiki is easy once you've done it, but you have to get used to it, especially if you're used to working with HTML. If your browser has [[JavaScript]] enabled, there will be a little formatting bar above your editing area. Try clicking on the buttons in that bar.
Formatting a wiki is easy once you've done it, but you have to get used to it, especially if you're used to working with HTML. If your browser has [[JavaScript]] enabled, there will be a little formatting bar above your editing area. Try clicking on the buttons in that bar.

===Syntax Highlighting===
Rosetta Code now supports syntax highlighting, to an extent. To apply it, you add a couple of HTML-like tags around your code example. Here is an example:

<pre><nowiki><highlightSyntax language=C>
// A C coment
</highlightSyntax></nowiki></pre>

That particular example looks like this:

<highlightSyntax language=C>
// A C Comment
</highlightSyntax>

Not all of the languages RosettaCode has are supported by the highlighter. To get support for your own language, you'll need to update the [http://www.beautifier.org/ PHP Beautifier package]. Send [[User:Short Circuit|Short Circuit]] an updated .phps file, and he'll install it. A complete list of packages supporting highlighting may be found at [[[Help:syntaxHighlighter Support]].


==Before you go==
==Before you go==

Revision as of 21:37, 20 February 2007

So you want to contribute code, eh? If you've used wikis before, it's actually very easy. If not, then you'll need a few pointers to get started.

Every page is editable (almost)

Almost every page in the wiki is editable. Even this page is editable. (See that tab at the top labeled "edit"?)

To edit a wiki, you need only click that "edit" tab, make changes in the text field on the resulting page, and click Submit. Really, though we'd rather you clicked Preview first, and then clicked submit once you were satisfied with how it looks.

Navigation

To add your own programming example, you must navigate to the programming task to which you wish to add a solution to. Once you find your task, go ahead and click the Edit button, and make your changes.

Formatting

Formatting a wiki is easy once you've done it, but you have to get used to it, especially if you're used to working with HTML. If your browser has JavaScript enabled, there will be a little formatting bar above your editing area. Try clicking on the buttons in that bar.

Syntax Highlighting

Rosetta Code now supports syntax highlighting, to an extent. To apply it, you add a couple of HTML-like tags around your code example. Here is an example:

<highlightSyntax language=C>
// A C coment
</highlightSyntax>

That particular example looks like this:

<highlightSyntax language=C> // A C Comment </highlightSyntax>

Not all of the languages RosettaCode has are supported by the highlighter. To get support for your own language, you'll need to update the PHP Beautifier package. Send Short Circuit an updated .phps file, and he'll install it. A complete list of packages supporting highlighting may be found at [[[Help:syntaxHighlighter Support]].

Before you go

In order to maintain the readability, searchability and browsability of Rosetta Code, we need you to follow certain formatting rules. Please ensure that your contributed code conforms to one of these programming example prototypes.

Now, why don't you wander over to the Sandbox and apply what you've learned?