diff --git a/public/js/md2html.js b/public/js/md2html.js index a925dcf..2fbd18c 100644 --- a/public/js/md2html.js +++ b/public/js/md2html.js @@ -284,7 +284,36 @@ const tokens2html = (tokens, title) => { for (let token of tokens) { switch (token.type) { case "toc": - output += "TABLE LE CONTENTOS" + let headers = tokens.filter(x => x.type == "header"); + + let listHTML = ''; + let currentLevel = 0; + + headers.forEach(header => { + let indent = ' '.repeat(header.level - 1); // Indentation based on header level + + // Check if we need to create a new