Search code examples
javascriptace-editor

Whats the difference between markers and dynamic markers in ace.js


What are the differences between the two?

addDynamicMarker(Object marker, Boolean inFront) 

Adds a dynamic marker to the session.


addMarker(Range range, String clazz, Function | String type, Boolean inFront) 

Adds a new marker to the given Range. If inFront is true, a front marker is defined, and the changeFrontMarker event fires; otherwise, the changeBackMarker event fires.


Solution

  • A marker is just a highlighted range.

    A dynamic marker is an object with update function which can return custom HTML.
    You can use it even to highlight diffs.