Building on Sam's (already fine) answer:
As mentioned on the MediaWiki Support desk, you can use HTML lists to make the table part of B2:
<ol>
<li> A1
<ol>
<li> B1
<li> B2
{| class=wikitable
! Header
|-
| Data
|}
</ol>
<li> A2
</ol>
The indentation is not required, but adding leading spaces for alignment makes the structure easier to comprehend visually.
Alternatively, you can use an HTML table within the wikitext list. Note that MediaWiki doesn't currently recognize <thead>
or <tbody>
, so omit those.
# A1
## B1
## B2 <table class=wikitable><tr><th>Header</th></tr><tr><td>Data</td></tr></table>
# A2
As noted in wakalaka's answer, you can (ab)use HTML comments to spread the table over multiple lines, if you wish.
The complexity of your list versus the complexity of your table will probably dictate which method you choose. A benefit of the latter solution is you can hide the gnarly HTML in a template or subpage and transclude it into the list with the expected alignment, which is not possible with the former (see the screenshot below).