Including javascript code in forum posts


    Nov 07 2011 | 12:57 am
    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?

    • Nov 07 2011 | 12:00 pm
      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)
    • Nov 11 2011 | 11:15 am
      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!
    • Nov 11 2011 | 4:11 pm
      You can use the pre tag to preserve formatting:
      function test() {
      	this is
      	my
      			silly
      			code
      }
      
    • Jul 07 2015 | 10:07 pm
      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!
    • Jul 16 2015 | 5:42 pm
      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!