edamame 0.1.6

A Terminal Markdown editor that stays rendered while you edit
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
# Blockquotes

> Part of the edamame contributor deep-dives. Index and project-wide conventions: [`AGENTS.md`](../../AGENTS.md). Sibling docs live in [`docs/dev/`](.).


- **The quote's style is a *base*, never a replacement.** `render_blockquote` renders inner blocks first, then prefixes each line with the `▎ ` bar, so every span arriving there has resolved its own style; overwriting them with `blockquote_text` silenced bold, italic, code spans, highlights, strikethrough and link color inside any quote (issue #33). Each span is now `base.patch(span.style)`, with the inner block's own line style (a nested code block's surface) layered into `base` first so it still wins. A new decoration wrapped around already-rendered lines owes the same shape.
- **`blockquote_text` is a background wash, not a text attribute** — a blanket ITALIC leaves `*emphasis*` inside a quote with nothing to say. It is `secondary` mixed almost all the way to `bg` (`QUOTE_BG_MIX_TOWARD_BG`), the same `blend` that is a no-op for non-RGB palettes, so `dark_256` / `light_256` pin it by hand and `Monochrome Dark` uses DIM.
- **The wash is carried by the *line* style, not by padding.** `line_render` fills a row's trailing cells with `Line::style`, extending the wash to the viewport edge and filling a wrapped continuation's indent zone (the bar is repainted there by `leading_bar_prefix`). Don't pad quote rows out to `viewport_width` the way `render_code_block` does — it would break the 1:1 raw↔rendered column relation.
- **Children render two cells narrower per level.** `render_blockquote` renders its children inside `Renderer::inset_by`, so `Renderer::width` (what table widths, rules, the big H1 and code surfaces size to) is the viewport less every enclosing bar; a footnote definition does the same for its leader, and a list item for the blocks it indents. Sized to the full viewport, a quoted table's rows came out two cells too wide and every one wrapped (#67). Width-sized output reads `width()`, never `viewport_width` directly. A column-resize drag has the same budget: `DragTarget::TableColumnBorder::table_left` records the table's rendered left `│`, and the drag may grow it only to the viewport edge. The inset needs no `RenderSettings` field: only top-level blocks are cached, at inset 0, and a nested block's inset follows from its top-level ancestor.
- **The revealed row keeps the wash.** `RenderedView` resolves a `reveal_base` from the cursor block's AST kind and hands it to `paint::make_raw_line_over`; without it the row being edited drops out of the block it visibly belongs to (same reason a revealed mermaid body row gets `make_code_styled_body_line`). A new block kind painting its own surface owes an arm there.
- **One row per source line, each bare `>` included.** The parser records the quote's line `span` and each child's; `render_blockquote` emits a quoted blank row for every line of the span the children's spans don't cover — before, between and after them — and nothing else. A bare `>` therefore always has its row and the quote never invents one (it once put a blank between every two children, whether the source had one or not, and dropped an empty quote, so every row below sat off its line). Two refinements keep that true:
  - An uncovered line that isn't bare is a link reference definition, which renders nothing. The parser lists those in `BlockQuote::hidden`; deciding needs the source text, which the renderer doesn't have.
  - The bare `>` between a loose list's items lies within the list's span, not in a gap between the quote's children, so the list gives it a row, as a loose list does at any depth.