Fog Creek Software
Discussion Board

Knowledge Base
Terry's Tips
Darren's Tips

Displaying Code

Are there any City Desk sites that display code? I am writing some documents where I want to display some code snippets (various languages are involved) and I wondered if anyone has already covered some of this ground.

David Ness
Sunday, December 9, 2001

Ooh. Ooh. This has "run this page through this extermal command line" written all over it. And a checkbox selecting whether or not to permit rich text beforehand. Oh, and/or "just get this page's contents from this file".

Hmmm. Just as there are different output templates selectable on a per article basis, there could be different input templates. "no rich content", "get from file", "get from script". "Run *through* this script" is even trickier: it's a filter template wedged between input and output.

If the forum was more CityDesk-ey, and Garth had access to the .about variable on a posting by posting basis, this .about would refer directly to Garth's contradictory desires to make CityDesk a whole lot more powerful at the same time as retaining its beautiful simplicity.

Garth Kidd
Sunday, December 9, 2001

I think I've done what you're looking for. I put code inside <pre></pre> tags, and use CSS to make it prettier.

I've got a few CityDesk articles on my site:

Have a look at the HTML and CSS on this page for a specific example:

Hope this helps! I'm trying to write how-to articles and collect examples of these types of things to help other CityDesk users. My site design's not finished yet, so please forgive the difficult navigation!

Darren Collins
Sunday, December 9, 2001

Thanks. With your help it took about 5 mins. to see how you displayed your code, and about the same time to get my code to be able to do it. That saved me a lot of trouble, and I appreciate it.

David Ness
Sunday, December 9, 2001

*  Recent Topics

*  Fog Creek Home