Page MenuHomePhabricator

Invoke ParserBeforeInternalParse from Parsoid
Open, Needs TriagePublic

Description

I don't know if any production extensions actually use this, but the ParserBeforeInternalParse hook allows mutating wikitext *before* the parse. This should be fine to do with Parsoid as well, and we might as well do it for compatibility.

Two issues:

  1. The hook includes strip state, so we'd need to address T257606: Extension API: strip state issues to make Parsoid compatible with strip state
  2. Parser::parseExtensionTagAsTopLevelDoc invokes recursiveTagParse which calls ParserBeforeInternalParse so embedded extensions in Parsoid output would end up getting the internal parse hook invoked twice, once at top level and then again when the extension tag is parsed. We should tweak parseExtensionTagAsTopLevelDoc to suppress the call to ParserBeforeInternalParse.