There is a setting $wgEnableExperimentalHtmlIds or something like that, but I think that it is only fully working in 1.18.