Mode Runner Demo模式运行器演示文档
Running a CodeMirror mode outside of the editor.在编辑器的外面运行一个CodeMirror模式。
The CodeMirror.runMode
function, defined in addon/runmode/runmode.js
takes the following arguments:CodeMirror.runMode
函数,定义在addon/runmode/runmode.js
中,取用下面的参数:
text (string)
The document to run through the highlighter.此文档通过高亮器运行。mode (mode spec)
The mode to use (must be loaded as normal).要使用的模式(必须如常规载入)output (function or DOM node)
If this is a function, it will be called for each token with two arguments, the token's text and the token's style class (may be如果这是一个函数,将针对每个口令调用它,带两个参数,口令的文档和口令的样式类(对于未样式的口令,可以是null
for unstyled tokens).null
)。If it is a DOM node, the tokens will be converted to如果它是一个DOM节点,口令将被转换为编辑器中的span
elements as in an editor, and inserted into the node (throughinnerHTML
).span
元素,并插入到节点中(通过innerHTML
插入)。