0

I can't get CodeMirror to set the theme to what i set it to.

folow the document at Codemirror Manual I've done this:

<head>
    <script src="Scripts/codemirror.js" type="text/javascript"></script>
        <script src="Scripts/javascript.js" type="text/javascript"></script>
        <link href="Styles/codemirror.css" rel="stylesheet" type="text/css" />
        <link href="Styles/elegant.css" rel="stylesheet" type="text/css" />


    <script type="text/javascript">
        var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
            lineNumbers: true,
            matchBrackets: true,
            mode: "text/x-csharp",
            theme: "Styles/elegant.css"
            });

    </script> 
</head>

I have tried many ways now, but i don't get how to, so i am asking for help.

There is no theme, syntax highlighting or lineNumber in the editor when i try it. I hope someone can explain this to me, thanks in advance.

4

1 回答 1

0

theme错误地使用了该选项。在这种情况下,将其设置为"elegant"。该问题是由 CodeMirror 将编辑器的 CSS 类(用于选择主题)设置为某些文件名造成的,当您在那里传递文件名时,这将阻止突出显示工作。

于 2013-10-31T09:37:01.723 回答