Search code examples
c#asp.netcodemirror

CodeMirror C# Highlighting


I am trying to highlight c-sharp with Code Mirror. Everything but the syntax highlight works. I am using .ASPX pages to delivery the content.

    <asp:TextBox runat="server" ID="codeBox" TextMode="multiline" Rows="30" Width="1000"></asp:TextBox>
      <script type="text/javascript">
        var editor = CodeMirror.fromTextArea(
                        document.getElementById("MainPagePlaceholder_codeBox"), 
                           { lineNumbers: true, matchBrackets: true, mode: "text/x-csrc" }
                        );

      </script>

I have the following stylesheets added:

<link href="codemirror.css" rel="stylesheet" type="text/css"/>
<link href="neat.css" rel="stylesheet" type="text/css"/>
<script src="/Scripts/mirror/clike.js"></script>
<script src="/Scripts/mirror/codemirror.js"></script>
<script src="/Scripts/mirror/matchbrackets.js"></script>

Solution

  • I figured it out. I was able to resolve this issue: codemirror.js needs to be first before clike.js.