CodeMirror plugin for Craft CMS
Add the awesome in-browser code editor CodeMirror as a field type., (*1)
 , (*2)
, (*2)
Installation
To install CodeMirror, follow these steps:, (*3)
- Install with Composer via composer require luwes/craft-codemirror
- Install plugin in the Craft Control Panel under Settings > Plugins
CodeMirror works on Craft 3.x and 4.x., (*4)
CodeMirror Overview
https://github.com/codemirror/codemirror, (*5)
Configuring CodeMirror
Copy the code below, create a file named code-mirror.php and place it in the craft config folder to override the default options., (*6)
php
return [
    'jsOptions' => [
        'theme' => 'default',
        'lineNumbers' => true,
        'lineWrapping' => true,
        'viewportMargin' => new JsExpression('Infinity'),
    ],
    'modes' => [
        'gfm', // the first mode is enabled by default
        'markdown',
        'htmlmixed',
        'javascript',
        'css',
        'xml',
    ],
    'addons' => [
        'mode/overlay', // needed for gfm (github flavored) mode
    ]
];, (*7)
Brought to you by Wesley Luyten, (*8)