简体   繁体   中英

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>

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM