CodeMirror 6 supports HTML widget decorations. The below editor uses widget decorations to render a checkbox within each markdown checklist item:
Alternatively, the editor can use replacement decorations: