Page 1 of 1

What are the rules for code snippets?

Posted: Wed Dec 02, 2009 1:46 pm
by Lysis
I've written articles with a one-line code snippet, but is it acceptable to put a large code snippet? I think a code snippet would enhance the article, but I'm not sure if it's allowed.

For example, I'm writing about an XML file format, and I wanted to give an example. So, I wanted to do something like:

An example of a sitemap file format is below:

<urlset>
<url>
<loc>url</loc>
<lastmod>2009-12-20</lastmod>
<changefreq>monthly</changefreq>
</url>
</urlset>


Is this ok? Also, in the programming world, tabs are a standard to format the code. So, basically the above should read:

<urlset>
<url>
<loc>url</loc>
<lastmod>2009-12-20</lastmod>
<changefreq>monthly</changefreq>
</url>
</urlset>

If a code snippet is allowed, is the above allowed?

**Edit...bah, the forum software is trimming my spaces!

Re: What are the rules for code snippets?

Posted: Wed Dec 02, 2009 1:47 pm
by Ed
Yes.

Re: What are the rules for code snippets?

Posted: Wed Dec 02, 2009 1:49 pm
by Lysis
Sweet!

And that was quick!