<!doctype html>
<title>CodeMirror: Theme Demo</title>
<meta charset="utf-8"/>
<link rel="stylesheet" href="https://cdn.staticfile.org/codemirror/5.58.1/codemirror.css">
<link rel="stylesheet" href="https://cdn.staticfile.org/codemirror/5.58.1/theme/dracula.css">
<script src="https://cdn.staticfile.org/codemirror/5.58.1/codemirror.js"></script>
<script src="https://cdn.staticfile.org/codemirror/5.58.1/mode/javascript/javascript.js"></script>
<style>
.CodeMirror {border: 1px solid black; font-size:13px; width:500px; height:200px}
</style>
<article>
<h2>Theme Demo</h2>
<form>
<textarea id="code" name="code">
function findSequence(goal) {
function find(start, history) {
if (start == goal)
return history;
else if (start > goal)
return null;
else
return find(start + 5, "(" + history + " + 5)") ||
find(start * 3, "(" + history + " * 3)");
}
return find(1, "1");
}
</textarea>
</form>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
lineNumbers: true,
styleActiveLine: true,
matchBrackets: true,
readOnly: true,
theme:"dracula",
viewportMargin: Infinity
});
</script>
</article>
codemirror
最新推荐文章于 2024-04-09 22:19:36 发布