I tried to solve this problem for days. I had an older spoiler extension wich worked quite fine. I wanted to continue developing it but it does no longer work anymore as intended. I found no way to make the “tag extension” to be inside a text AND with working wiki text inside the extension without the text above and below resulting in generating own paragraphs.
Practically I want (watch the p-tags). When clicking the button the content of the spoiler-tag is visible. Worked fine before on a older wiki version:
<p>This is some Text.<spoiler title="Test">This is spoiler content with some wiki text. When this button is clickend. This text is visible, as a block element</spoiler> This is some other text.</p>
But what I get is:
<p>This is some Text.</p> <spoiler title="Test">This is spoiler content with some wiki text. When this button is clickend. This text is visible, as a block element</spoiler> <p>This is some other text.</p>
Please keep in mind that the results into generating valid HTML. Here I wrote it this way so you can visualize it better. I have found out that that Tidy is replaced with an HTML 5 parsing algorithm.
I tried almost everything. I replaced all div tags of my extension with spans (not semantic HTML) because only this way the button stays inline and no p tags is wrapped before and after the spoiler button. That is not a CSS problem because display: inline-block; is set. The problem ist the parser. I tried all possible code I have found on mediawiki docs. Some of them (and in combination):
$striped_text = $parser->killMarkers( $render ); $render = $parser->recursiveTagParse($striped_text); $render = $parser->insertStripItem($render, $parser->mStripState);