Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

putting code on a web page 2

Status
Not open for further replies.

Chance1234

IS-IT--Management
Jul 25, 2001
7,871
US
Im writing up some tutorials for me site; ( and want to put code samples on a page.

The thing i hate is when you copy paste code from a web page and it looses all it formating.

So was wondering what peoples thoughts and ideas were .



Chance,

Filmmaker, gentleman and polla stilo eleous
 
wrap it in <pre> tags or place it in a textarea form element

If it's HTML you will also want to convert the < and > characters to ascii codes or the entities &lt; and &gt;

<honk>*:O)</honk>

Tyres: Mine's a pint of the black stuff.
Mike: You can't drink a pint of Bovril.
 
Tis is C# is there then anyway to put back in the colouring ?

Chance,

Filmmaker, gentleman and polla stilo eleous
 
Colouring?

Surely that's something that is editor specific?

The only ways to do that would be
1. As an image - yuk
2. use html span tags and some css to style the spans' contents



<honk>*:O)</honk>

Tyres: Mine's a pint of the black stuff.
Mike: You can't drink a pint of Bovril.
 
You could try something like Dean Edward's 'Star-Light' enhancer, which is script to give "pre" code syntax highlighting on-the-fly. It supports:

* JavaScript
* HTML
* CSS
* XML
* PHP
* Email
* VBScript*
* T-SQL*


No idea about browser support outside of IE, but it can't be that hard to port...

Hope this helps,
Dan

Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Ooh that's handy.

<honk>*:O)</honk>

Tyres: Mine's a pint of the black stuff.
Mike: You can't drink a pint of Bovril.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top