-6

I have spent a lot of extra effort formatting my question to be more readable, by using <pre> with <b> inside, rather than plain-texting everything.

When I click the "Post your question" button, I get shown this error:

enter image description here

But the code is all correctly-formatted, and the markdown preview of the entire question looks exactly as I expect it to.


According to Stack Overflow prevents me from posting an answer, claiming markdown text using HTML tags is unformatted code

Stack Overflow uses a system to stop low-effort unformatted posts from being posted.

My post is high-effort and well-formatted.

So I am reporting this bug.


If this is intentional, then obviously the error message should be different.

Your post appears to contain code that is not properly formatted as code

The above is an unclear error message. It should actually say:

Stack Overflow does not support <pre> tags in markdown.

So then I can know

  1. That this is a feature, not a bug
  2. How to transform my question to make the automated system accept it

Here is the entire markdown source of my question that fails to be posted:

`python manage.py showmigrations` shows 

<pre>
<b>mainapp</b>
 [X] 0001_initial
...
 [X] 0240_employer_data
 [X] 0241_person_metadata
 [X] 0242_personemployer_employerworkplace
 [X] 0243_personemployer_employed_personemployer_stage
 [X] 0244_remove_employerworkplace_and_more
</pre>

I ran

```
python manage.py squashmigrations mainapp 0244
```

and now `showmigrations` shows

<pre>
<b>mainapp</b>
 [-] 0001_squashed_0244_remove_employerworkplace_and_more (244 squashed migrations) Run 'manage.py migrate' to finish recording.
</pre>

But `python manage.py migrate` reports the errors

```
No migrations to apply.
Your models in app(s): 'mainapp' have changes that are not yet reflected in a migration, and so won't be applied.
Run 'manage.py makemigrations' to make new migrations, and then re-run 'manage.py migrate' to apply them.
```

How can there be changes detected immediately after running squashmigrations without doing anything in between?

`python manage.py makemigrations --dry-run` shows many "Alter field" lines like

<pre>
<b>Migrations for 'mainapp':</b>
  <b>mainapp/migrations/0001_squashed_0244_remove_employerworkplace_and_more.py</b>
    ~ Alter field field on employergroup
    ~ Alter field image_alt on employee
    ~ Alter field context on employer
    ...
</pre>


# My expectation:

After running `squashmigrations`, `makemigrations` should show "No changes detected"

So what happened? What might have caused this bizarre situation? How might I fix it?

I have tried replacing some <pre> with ``` code fences.

The question can only be posted after every single <pre> is replaced by a code fence.

New contributor
Nils is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
14
  • And now I can't post my question at all because I just reported this bug... I have to wait 90 minutes
    – Nils
    Commented yesterday
  • You can probably work around it by adding <code> tags inside of the <pre>
    – cafce25
    Commented yesterday
  • @cafce25 I've tried both ways, and it won't let me post, with the same error
    – Nils
    Commented yesterday
  • 9
    Have you considered using markdown for everything, rather than html? Stack Overflow doesn't allow all forms for HTML, so if you are using a good amount of it, the editor may well detect you are trying to post unformatted code.
    – Thom A
    Commented yesterday
  • 1
    @ThomA of course, and I'm trying to post such a question now, with ``` instead of <pre>. But stackoverflow shouldn't show me a working preview if they don't support it IMO. I've seen many questions on the site using <pre> and they all work.
    – Nils
    Commented yesterday
  • 8
    The solution is to use code fences instead of pre. Yes, pre is supported HTML syntax, but because you use so much of it, the parser thinks you're posting unformatted code, as pre isn't the preferred method of posting code blocks. (I wouldn't be surprised if that system counts pre blocks as "unformatted HTML")
    – Cerbrus
    Commented yesterday
  • "My post is high-effort and well-formatted." - You seem incorrectly understand the referenced question and its answer. It is known that detector of unformatted code sometimes incorrectly classifies html tags. But you shouldn't use html tags in the first place, and prefer markdown syntax. BTW, the referenced question is tagged with bug too.
    – Tsyvarev
    Commented yesterday
  • "This is not a bug, this is a feature" actually applies, in this case.
    – Cerbrus
    Commented yesterday
  • @Cerbrus even if I just use one single <pre>, I get this error (just tried, by editing my question and replacing a single code fence with a <pre>)
    – Nils
    Commented yesterday
  • @Cerbrus do you think I got downvoted because I posted a bug-report when it should have been a feature-request?
    – Nils
    Commented yesterday
  • 1
    @Nils It shouldn't be either. This is a request for support: "My question gets blocked because of <error>, what did I do wrong?"
    – Cerbrus
    Commented yesterday
  • 8
    @Nils Then don't use pre at all. Use code fences for your code. Don't use code-like formatting for text that isn't code.
    – Cerbrus
    Commented yesterday
  • 3
    Sometimes teh best solution to a problem is to not do the thing causing the problem
    – Kevin B
    Commented yesterday
  • 2
    @KevinB it's not essential to me that I be able to post well-formatted, beautiful questions. I just encountered surprising behaviour that I thought was a bug, so I reported it. The error message is telling me something that is untrue.
    – Nils
    Commented yesterday

0

Browse other questions tagged .