I would like to display code - How to do this?

Under:

Code can be displayed in filtered HTML or  full HTML. To display code, you have two solutions:

  1. Use the regular <pre></pre> HTML tags
  2. Use the <code></code> tag

Using the second, Drupal will format your code using the VIM-color module. Note that the <code> syntax can recognize code automatically from the first line like in

<code type="perl">
#!/usr/local/bin/perl
use DBI;
print "Hello world\n";
</code>    

which will be displayed as

     
#!/usr/local/bin/perl
use DBI;
print "Hello world\n";
unlike the use of <pre></pre> which would display

#!/usr/local/bin/perl
use DBI;
print "Hello world\n";

 

WARNING: Note that switching between enable rich-text and normal mode while using <code> may scramble your formating. This was also noted in ... create a cross-reference to another page.