I have a website that I am making that uses the highlight.js script. It's basically a syntax highlighting javascript code that highlights all <code> blocks. I have a <code contenteditable> block. I wanted to make it so that the syntax highlighting is realtime, or in other words, call the higlight function whenever the content is edited. How can I achieve this?
Django HTML:
<link rel="stylesheet" href="{% static 'tokyo-night-dark.min.css' %}">
<div class="main">
<pre><code contenteditable>{{code}}</code></pre>
</div>
Function to execute:
<script>hljs.highlightAll();</script>