Support nested Markdown heading levels
This commit is contained in:
@@ -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 + ">";
|
||||
|
||||
Reference in New Issue
Block a user