question

laurenceh avatar image

How do I post code without it being mangled

How can I make sure that the code I put in the page editor is the same as what other forum users will see?


I posted an article (as a question) - where’s my boat? - but the code segments I included got badly mangled when I submitted the article. Some blank lines are important in the python I posted and the code will not work without them, but they have been lost.

The code looks fine in the page editor and is only wrong after it is posted.

Also there does not seem to be a topic which is relevant to this question. How are topics added or what topic should I post ( at least one valid topic is required.

modifications
2 |3000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

2 Answers
laurenceh avatar image
laurenceh answered ·

That is exactly what I did to insert the code box, the text inside the code box is mangled.

This is what it the code you posted above should look like.

#CGIhandler = /usr/bin/perl:pl

#CGIhandler = /usr/bin/php-cgi:php

# enable by LH to run py as cgi scripts

CGIhandler = /usr/bin/python:py

#CGIhandler = /usr/bin/ruby:rb

#CGIhandler = /usr/bin/ssi-cgi:shtml

#CGIextension = cgi


But what I see when I look at your post is like whites with a strange 5. :


Perhaps my question is, is it possible to post code snippets inside a code box without them being displayed strangely?


2 |3000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

osaether avatar image
osaether answered ·

Hello!


Try using the </> code tag found on the tools bar above the editor:

#CGIhandler = /usr/bin/perl:pl
#CGIhandler = /usr/bin/php-cgi:php
# enable by LH to run py as cgi scripts
CGIhandler = /usr/bin/python:py
#CGIhandler = /usr/bin/ruby:rb
#CGIhandler = /usr/bin/ssi-cgi:shtm


2 |3000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.