Auto highlight new code

105 views
Skip to first unread message

Emil Ratazhkowski

unread,
Jun 13, 2018, 11:31:34 AM6/13/18
to highlight.js
I'm trying to make this plugin to highlight code while user typing the code. Write some code


function update(){
 hljs
.highlightBlock(document.getElementById('inp'));
}

$
('pre').on('input', function(){
 clearTimeout
(hid);
 hid
= setTimeout(update, 1000);
})

The main issue is that after each call of highlightBlock
cursor jumps to the beginnig of the code. Maybe there is some solution for that?
Reply all
Reply to author
Forward
0 new messages