Support nested Markdown heading levels

This commit is contained in:
udo
2026-07-17 05:27:00 +00:00
parent 8dbff881a1
commit dbb8ae2c4b
5 changed files with 23 additions and 2 deletions
+4
View File
@@ -1218,6 +1218,10 @@ String markdown_render_node(DValue node, DValue& options)
else if(type == "heading")
{
s64 level = int_val(markdown_get_string(node, "level", "1"));
s64 heading_offset = int_val(markdown_get_string(options, "heading_offset", "0"));
if(heading_offset < -5) heading_offset = -5;
if(heading_offset > 5) heading_offset = 5;
level += heading_offset;
if(level < 1) level = 1;
if(level > 6) level = 6;
html = String("<h") + level + ">" + children_html + String("</h") + level + ">";