Codemirror

This plugin enables source code highlighting, powered by CodeMirror. For all available settings and commands, please refer to CodeMirror User Manual.

This plugin is only compatible with Redactor II 1.0.1 or higher.

Download Plugin

<!DOCTYPE html>
<html>
    <head>
        <title>Redactor</title>
        <meta charset="utf-8">

        <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.js"></script>

        <link rel="stylesheet" href="/js/redactor/redactor.css" />
        <script src="/js/redactor/redactor.js"></script>

        <!-- Codemirror -->
        <link rel="stylesheet" href="/js/codemirror/codemirror.css" />
        <script src="/js/codemirror/codemirror.js"></script>
        <script src="/js/codemirror/xml/xml.js"></script><p>
        <!-- Plugin -->
        <script src="/js/redactor/plugins/codemirror.js"></script>

        <script type="text/javascript">
        $(function()
        {
            $('#redactor').redactor({
                plugins: ['codemirror'],
                codemirror: {
                    lineNumbers: true,
                    mode: 'xml',
                    indentUnit: 4
                }
            });
        });
        </script>
    </head>
    <body>
        <textarea id="redactor">...</textarea>
    </body>
</html>