Community & Support

Suggestions for a plugin/way to display sample html/css/javascript code (without getting rendered)?

Hi!

Not new to CMS but new to Drupal.

Is there any plugin/module/way by which I can display sample html/css/javascript code on Drupal pages without the code getting rendered?

Where would I find such a thing?

Thank you!

Comments

You can use the <code> tag,

You can use the <code> tag, just like you can do here on the forum, is that sufficient? If you're looking for syntax highlighting, check out the geshi filter module at http://drupal.org/project/geshifilter.

Hi marcvangend! Yes, I have

Hi marcvangend!

Yes, I have tried the tag. Problem is that every time I dump my javascript code alongside some html onto that page (with or without the code tag), it renders. Is there any way I can prevent that from happening?

Haha, I can see you know the

Haha, I can see you know the < c o d e > tag :-)
Are you sure the javascript code is executed, or is it just stripped? I'm not sure why it doesn't work. Maybe you can try to wrap the javascript in html comment tags: <!-- your javascript here -->? I'm not sure if it helps but it's worth a shot.

hehe, yeah! It just renders

hehe, yeah! It just renders regardless! Youtube solved this by putting the code snippets into a read-only input field with some javascript attached to it. Assuming they know more about this than I do... perhaps that's how it needs to be. A read-only textarea.

All right, so the solution

All right, so the solution was to replace the tag brackets with ascii code:

< with ascii# 60 and > with ascii# 62

;-)

Thanks a lot for your help!