display html snip in a how-to

Permalink 1 user found helpful
I just wrote a how to on how to integrate some add ons. The page has not been approved yet. I want to display HTML code to users for use on their own sites. Regardless if the HTML is in [code][/code] or not it wants to render. What is the proper way to do this?

enlil
 
enlil replied on at Permalink Reply
enlil
I'm guessing once the page is approved it will render correctly with [code][/code] being used?!
JohntheFish replied on at Permalink Best Answer Reply
JohntheFish
Howtos use markdown format, so [code] segments dont work.

In markdown, code is usually just an indented block.

For html, the easiest way to make sure it does not get rendered is to use the sequence & l t ; tagname & g t ; (but with the spaces removed). I tend to write such parts in a text editor and use a global replace to make such changes before cut & paste.

If it was your own documentation (rather than a c5 howto), then my Syntax Anywhere addon can take care of making such changes to html for you.
JohntheFish replied on at Permalink Reply
JohntheFish
The same markdown format is used in the concrete5 markdown block and in Universal Content Puller's markdown source. So you can use either to check through howtos written offline. There are also online utilities for processing markdown.
enlil replied on at Permalink Reply
enlil
Just tried that and it didn't seem to work. I was able to display the html by adding a space after every < and before every >. Users would have to remove the spaces if they wanted to copy paste the snip to their own site, but this way it displays and gives them the right idea.
enlil replied on at Permalink Reply
enlil
I figured it out. I simply added some spaces to the left of the code snip and it now displays the snip in a code box!! Minimum of four spaces required before it displays in the box.
goldhat replied on at Permalink Reply
What about PHP snippets? Wrap them in PHP tags, don't wrap them, wrap them then convert them? I tried with 4-spaces and no php tags, doesn't work that way.
enlil replied on at Permalink Reply
enlil
I don't know markdown very well but looking at this documentation, it looks like it should work if you indent and wrap it in it's proper tags. I could be wrong though..

http://daringfireball.net/projects/markdown/syntax...
goldhat replied on at Permalink Reply
Yes 4 spaces does work fine but the issue is don't put your code on the first line. Probably the spaces get stripped or ignored in processing the input into the textarea and the result is it will get ignored.

Thanks for your help.
JohntheFish replied on at Permalink Reply
JohntheFish
I think there is currently a bug in the howto editor, so now may not be the best time to risk editing any existing howtos containing html or php examples.

http://www.concrete5.org/developers/pro-accounts/community-leaders-...