CodeMirror Highlight Active Line

• Nasil-Yapilir • Bilgisayar

In order to highlight the active (current) line in the Codemirror, we must first import active-line.js file from addon>selection> active-line.js folder .

Import active-line.js

<link rel='nofollow' href="codemirror/codemirror.css" >
<script src = "bootstrap/codemirror-5.41.0/lib/codemirror.js">
<script src = "codemirror/addon/selection/active-line.js">

Then between script tag we should add the expression : styleActiveLine: true

Add StyleActiveLine: true

var editor = CodeMirror.fromTextArea(myTextarea, {
mode: "application/xml",
styleActiveLine: true,// add this line

That is all.