"code" window needed

dagon
  7 years ago
  11
  Selected

There is need for a code window to present unformatted
text for programming examples etc.

If you want to write for instance an include statement:
#include <stdio.h>

it will print out like:
#include

The rest is dropped. If you figure out how to include those characters then that could eventually lead to a worse problem... the beginner who wants to try out your code will most likely try to copy and paste your example in a text- editor and compile it directly. There are a whole bunch of different browsers and editors out there and our beloved beginner could end up pasting a code example with rests of the formatting. (been there, done that... :( )
(although it works for me here with firefox/gedit)

ref:
How to run C program in linux?
Latest comments
oscar799 7 years ago

Marked "Considered"


kazztan0325 7 years ago

@dagon:
Yes, I agree with you.


dagon 7 years ago

Maybe. But I would really prefer to just write plain text like in a text editor. That way I could throw in a line of super-hot c-code and not worry about it.


kazztan0325 7 years ago

Maybe we would need to add HTML tag for showing program source code like below:

<pre><code>
source code
</code></pre>


dagon 7 years ago

Here is one bug of concern:
http://drupal.org/node/1258998


trollboy 7 years ago

Apparently not. (that was <pre> by the way)


trollboy 7 years ago

It's an annoyance all right. Although it may be a problem with the editor rather than the site. Maybe using

will do something?