Bad escaping of symbols on the forum post preview


#1

If I try to post a code with #include’s using the angle-bracket syntax, immediately after a bullet list item, the formatting breaks.

Here is the original preformatted text:

#include <juce_audio_formats/juce_audio_formats.h>
#include <juce_audio_processors/juce_audio_processors.h>
  • Issue-reproducing example:

    #include <juce_audio_formats/juce_audio_formats.h>
    #include <juce_audio_processors/juce_audio_processors.h>

The same thing is posted in both places.


#2

Try:

 - Issue-reproducing example:

        #include <juce_audio_formats/juce_audio_formats.h>
        #include <juce_audio_processors/juce_audio_processors.h>

The same thing is posted in both places.

You need 6 spaces as opposed to 3 when in a list

  • Issue-reproducing example:

     #include <juce_audio_formats/juce_audio_formats.h>
     #include <juce_audio_processors/juce_audio_processors.h>

#3

I think what he meant is that you can’t have a code block after a list, as in

  • foo
  • bar

(It works if you have this paragraph in between)

Function foo(int bar)
{
    // stuff
}

On the other hand without that paragraph in between:

  • foo

  • bar

    Function foo(int bar)
    {
    // now the indentation is interpreted as a continuation of that list item
    }

I think this is a case where the markdown syntax is a bit ambiguous. I don’t know how to work around this.


#4

Discussed on Stack Exchange

What seems to work well in this scenario is:


Option A (caret plus five spaces), Markdown:

- point one
- point two

>     #include <juce_audio_formats/juce_audio_formats.h>
>     #include <juce_audio_processors/juce_audio_processors.h>
>
>     void myCode (int arg)
>     {
>         // do stuff
>     {

Option A (caret plus five spaces), Result:

  • point one
  • point two
#include <juce_audio_formats/juce_audio_formats.h>
#include <juce_audio_processors/juce_audio_processors.h>

void myCode (int arg)
{
    // do stuff
{

Option B (eight spaces), Markdown:

- point one
- point two

        #include <juce_audio_formats/juce_audio_formats.h>
        #include <juce_audio_processors/juce_audio_processors.h>
        
        void myCode (int arg)
        {
            // do stuff
        {

Option B (eight spaces), Result:

  • point one

  • point two

      #include <juce_audio_formats/juce_audio_formats.h>
      #include <juce_audio_processors/juce_audio_processors.h>
      
      void myCode (int arg)
      {
          // do stuff
      {
    

I think one of those is probably what @tsenkov was after…?


#5

Thanks guys. And sorry for the late response.

  • The 8-space indention:

      #include <variant/seem/to/be/working.h>
      #include <but/it/would/be/awesome/if/the/Preformatted text/button.h>
      #include <was/doing/this/for/us.h>
    

Cheers!