diff --git a/src/component/markdown.rs b/src/component/markdown.rs index 2d20f00..6f0dbd9 100644 --- a/src/component/markdown.rs +++ b/src/component/markdown.rs @@ -152,6 +152,8 @@ impl MarkdownText { let mut cursor = tree.walk(); cursor.goto_first_child(); + let mut is_first_heading = true; + fn block_for_node( cursor: &mut tree_sitter::TreeCursor, content: &str, @@ -394,16 +396,16 @@ impl MarkdownText { } }; - let block = match marker_node_kind { + let mut block = match marker_node_kind { | MARKDOWN_KIND_ID_ATX_H1_MARKER => block .text_size(rems(2.25)) .font_weight(gpui::FontWeight::EXTRA_BOLD) - .mb_8(), + .mb_6(), | MARKDOWN_KIND_ID_ATX_H2_MARKER => block .text_2xl() .font_weight(gpui::FontWeight::BOLD) .mt_12() - .mb_6(), + .mb_4(), | MARKDOWN_KIND_ID_ATX_H3_MARKER => block .text_xl() .font_weight(gpui::FontWeight::SEMIBOLD) @@ -418,6 +420,11 @@ impl MarkdownText { } .text_color(theme.colors.text); + if is_first_heading { + is_first_heading = false; + block = block.mt_0(); + } + cursor.goto_parent(); self.blocks.push(block);