Refactor CommonMark instance creation
<!-- Please search existing work items before filing to avoid duplicates. --> <!-- Also check open feature request work items to avoid duplicating existing proposals. --> ## Summary Following #3586595 , we moved league/commonmark to be a real dependency for the AI module. In this we create CommonMarkConverter objects, all with different options. ```php public function getCommonMarkConverter(): object { return new CommonMarkConverter(); } ``` ```php $converter = new CommonMarkConverter(['html_input' => 'escape']); ``` ```php $converter = new CommonMarkConverter([ 'html_input' => 'strip', 'allow_unsafe_links' => FALSE, ]); ``` It would be good to introduce some sort of service that would dependency inject the commonmarkconverter option so that the options that are injected are standardized correctly across the instance uses. ## Problem Without dependency injection, anywhere CommonMarkConverter is used could use non-standard options, resulting in unexpected behavior. <!-- /label ~"aiAgent" --> <!-- /label ~"aiApiExplorer" --> <!-- /label ~"aiAssistantsApi" --> <!-- /label ~"aiAutomators" --> <!-- /label ~"aiChatbot" --> <!-- /label ~"aiCkeditor" --> <!-- /label ~"aiContentSuggestions" --> <!-- /label ~"aiEca" --> <!-- /label ~"aiExternalModeration" --> <!-- /label ~"aiLogging" --> <!-- /label ~"aiObservability" --> <!-- /label ~"aiSearch" --> <!-- /label ~"aiTest" --> <!-- /label ~"aiTranslate" -->
issue