In this preview old looks different from the current page, a lot of icons are collected at the top.
Extension talk:ParserMigration
This is a fascinating bug. :-) https://sv.wikipedia.org/wiki/Mall:Teckenf%C3%B6rklaring_(linjekarta_j%C3%A4rnv%C3%A4g_bana) looks just fine. That is the old Tidy.
But https://sv.wikipedia.org/w/api.php?action=parser-migration&format=json&title=Mall:Teckenf%C3%B6rklaring_(linjekarta_j%C3%A4rnv%C3%A4g_bana)&config=old (which is also the old Tidy) shows that the icons have been fostered out of the table. Just documenting it here for now.
I made this edit to the bs-q template and that fixed the preview. Not sure why it was not broken in the direct view but only in the parsermigration-view .. but, I'm not going to spend more time trying to investigate that :)
Thanks for fixing it. Here is another example.
This one is more involved. I made this fix (it has a stray </div> tag) and then reverted it because alongwith that fix, all portal pages that use it also need fixes. I know how to fix that page (a </div> is needed after line 8) but I think all pages in this list needs to be examined and possibly fixed up. So, I am going to leave this to the svwiki template editors.
Also seen on many ptwiki pages (Example which is because of some hacky code that emits broken html in this template (lines 364-370)).
I know what the problem is. The parser migration extension tidies output with the <div class="mw-parser-output"> wrapper and this seems to trip up Tidy whenever there is a stray </div> tag in a nested table. We'll fix this in January, but looks like it is a useful "feature" that is exposing broken templates. :-)
The footer </div> is started in the header, so it should stay. The problem was a footer without a header (fix).
Great that you found the problem. While the current behaviour in some sense exposes problems, it mostly makes linting confusing.