I added line breaks to correct the code box.
/vendor/ganuonglachanh/flarum-ext-markdown-editor/js/forum/dist/extension.js
Line 337
this.insertAroundCursor('```', '```');
changed to
this.insertAroundCursor('```\n', '\n```');
To align the buttons correctly
.EnhancedTextEditor-toolbar {
margin-left: -20px;
}