index.haml
(index.haml)
%script(src="https://codemirror.net/lib/codemirror.js")
%script(src="https://unpkg.com/jsonlint@1.6.3/web/jsonlint.js")
%script(src="https://codemirror.net/addon/lint/lint.js")
%script(src="https://codemirror.net/addon/lint/json-lint.js")
%link(src="https://codemirror.net/lib/codemirror.css")
%link(src="https://codemirror.net/addon/lint/lint.css")
%script(src="https://codemirror.net/mode/javascript/javascript.js")
%script(src="https://codemirror.net/mode/css/css.js")
%script(src="https://codemirror.net/")
%script(src="https://codemirror.net/")
%testarea#json
index.coffee
(索引咖啡)
editor = CodeMirror.fromTextArea(document.getElementById('json'),
lineNumbers: true
mode: "application/json"
lint: true
gutters: ["CodeMirror-lint-markers"]
)
No warnings shown on the page.
(页面上没有显示警告。)
How could I make it work?
(我该如何运作?)
I implemented this referencing the official doc and demo.(我参考了官方文档和演示来实现了这一点。)
- https://codemirror.net/doc/manual.html#addons
- https://github.com/codemirror/CodeMirror/blob/master/demo/lint.html
(https://github.com/codemirror/CodeMirror/blob/master/demo/lint.html)