Manual:$wgWellFormedXml

Details
Whether to try to make our HTML output well-formed XML even if  is true.

If set to false, output will be a few bytes shorter, and the HTML will arguably be more readable.

If set to true, life will be much easier for the authors of screen-scraping bots, and the HTML will arguably be more readable.

Setting this to false may omit quotation marks on some attributes, omit slashes from some self-closing tags, omit some ending tags, etc., where permitted by HTML5. Setting it to true will not guarantee that all pages will be well-formed, although non-well-formed pages should be rare and it's a bug if you find one. Conversely, setting it to false doesn't mean that all XML-y constructs will be omitted, just that they might be.

Because of compatibility with screen-scraping bots, and because it's controversial, this is currently left to true by default.

In version 1.16.0, this implies the doctype is changed to XHTML 1.0 Strict to make named character references work in XML.

From version 1.17, named character references are avoided.