Including javascript code in forum posts

Luke Hall's icon

It looks like the click-to-expand method of pasting in copy-compressed max patches breaks when you try to include anything else wrapped in code tags. I really love the feature but is there any way to preserve whitespace properly when posting other code snippets, like javascript, to the forum?

FRid's icon

I would just post a patch with a comment displaying the js-code.

(I've always been curious to why nobody shares their email on the forum this way)

Luke Hall's icon

Good idea, I'm not sure why I didn't think of that, the [js] object is even clever enough to keep the indentation, even if [comment] does not display it!

Wesley Smith's icon

You can use the pre tag to preserve formatting:

function test() {
    this is
    my
            silly
            code
}
Anangel Argonaut's icon
Testing testing

^ I was… testing. I was trying to understand why wrapping a < pre > around < code > wasn't working, it appears using just < pre > does it. To admins, feel free to delete this reply!

C74 Ginger's icon

Hi friends,

Anangel Argonaut is right, in that pre tags are best for multi-line code.

Some quick tips on the forum can be found here. But if you have anything that you think should be pointed out, we'd be glad to hear suggestions!