diff --git a/src/renderer.rs b/src/renderer.rs index 8f9773f..716f350 100644 --- a/src/renderer.rs +++ b/src/renderer.rs @@ -92,18 +92,6 @@ impl RenderState { self.style_stack.push(new_style); } - /// Push a completely new foreground-colored style. - fn push_fg(&mut self, color: Color) { - let new_style = Style::default().fg(color); - self.style_stack.push(new_style); - } - - /// Push a new style with a foreground color and modifier. - fn push_fg_mod(&mut self, color: Color, modifier: Modifier) { - let new_style = Style::default().fg(color).add_modifier(modifier); - self.style_stack.push(new_style); - } - // ── Line flushing ───────────────────────────────────────────────────────── /// Flush `current_spans` into a `Line`, optionally prepending blockquote borders. @@ -184,20 +172,22 @@ impl RenderState { self.push_blank(); } - // ── Code block stub ─────────────────────────────────────────────────────── - // (will be replaced in Task 2 with full border + highlighting) + // ── Code block emitter ──────────────────────────────────────────────────── - fn emit_code_block_stub(&mut self) { + /// Flush the accumulated code buffer and emit a bordered, syntax-highlighted + /// code block into `self.lines`. + fn emit_code_block_now(&mut self) { let code = std::mem::take(&mut self.code_buf); let lang = std::mem::take(&mut self.code_lang); let width = self.width; emit_code_block(&code, &lang, width, &mut self.lines); } - // ── Table stub ──────────────────────────────────────────────────────────── - // (will be replaced in Task 2 with full box-drawing grid) + // ── Table emitter ───────────────────────────────────────────────────────── - fn emit_table_stub(&mut self) { + /// Flush the accumulated table rows and emit a full box-drawing grid table + /// into `self.lines`. + fn emit_table_now(&mut self) { let alignments = std::mem::take(&mut self.table_alignments); let rows = std::mem::take(&mut self.table_rows); emit_table(&alignments, &rows, &mut self.lines); @@ -284,7 +274,7 @@ fn handle_event(state: &mut RenderState, event: Event) { } Event::End(TagEnd::CodeBlock) => { state.in_code_block = false; - state.emit_code_block_stub(); + state.emit_code_block_now(); } // ── Lists ───────────────────────────────────────────────────────────── @@ -388,7 +378,7 @@ fn handle_event(state: &mut RenderState, event: Event) { } Event::End(TagEnd::Table) => { state.in_table = false; - state.emit_table_stub(); + state.emit_table_now(); } Event::Start(Tag::TableHead) => { state.in_table_head = true;