1/*  DokuWiki MoaiEditor Highlight.js file
2    Version : 0.5a (May 6, 2026)
3    Author  : MoaiTools <info@moaitools.org>
4    License : GPL 3 (http://www.gnu.org/licenses/gpl.html) */
5
6/*  This is the umbrella class for the syntax highlighting of the editor.
7*/
8MoaiEditor.Highlight = class {
9
10    constructor(outer) {
11
12        // Arguments
13        this.outer = outer;
14
15        // Objects
16        this.header = new MoaiEditor.HighlightHeader(this);
17    }
18    // ────────────────────────────────────
19    highlight (line) {
20        const syntax = line.highlight.syntax;
21        const content = line.querySelector('.moaied-mirror-line-content');
22        if (syntax == 'header')
23            this.header.highlight(content, syntax, line.text);
24        else
25            content.textContent = line.text;
26    }
27    // ────────────────────────────────────
28    createHTML(htmlString) {
29        var div = document.createElement('div');
30        div.innerHTML = htmlString.trim();
31        return div.firstChild;  // Change this to div.childNodes to support multiple top-level nodes.
32    }
33}; // End Class
34