Provide an interface for syntax highlighting in core, without an implementation. Implementation would be provided by SyntaxHighlight.
This would solve the following problems:
- Core currently puts JS/CSS/Vue code within <pre> tags in the parser output. SyntaxHighlight then overwrites the whole parser output using ContentAlterParserOutput hook. This unclean design is confusing as any changes done to fillParserOutput() in core content handlers have no effect on any wiki that uses SyntaxHighlight.
- In Scribunto, parser output includes highlighted code along with other things. This requires a tight coupling between Scribunto and SyntaxHighlight. Scribunto checks if SyntaxHighlight is installed and calls its methods directly.
- If there were a core content model with similar requirements (eg. the experimental T407709: SVG content model), it won't be possible at all as core can't call an extension.
- T146771: Transclusion of pages with CSS/JS/JSON/LUA content model transcludes the plain text without styling asks for transclusions of code pages to be styled. The proposed patch styles them using plain <pre> tags. There is no way for SyntaxHighlight to improve the styling, short of creating a new hook called from TextContent::getWikitextForTransclusion().
TL;DR: core providing such an interface helps reduce the use of hooks.