feat(03-01): extend renderer with LinkRecord extraction and link styling

- Add LinkRecord struct (line_index, col_offset, span_len, dest, is_wiki)
- Add PendingLink and PendingLinkRecord helpers in RenderState
- Enable ENABLE_WIKILINKS option in pulldown-cmark parser
- Handle Tag::Link Start: compute col_offset, determine broken wiki-link style
- Handle TagEnd::Link: compute span_len, enqueue PendingLinkRecord
- Update flush_line() to finalize pending link records with line_index
- Update render_markdown() signature to return (Vec<Line>, Vec<LinkRecord>)
- Add vault_path: Option<&Path> parameter for render-time broken link detection
- Update app.rs handle_resize and main.rs call sites to destructure tuple
- Wiki-links render as [Text] in LightCyan; broken wiki-links in Red+CROSSED_OUT
This commit is contained in:
2026-02-28 23:04:20 +01:00
parent cf58e31bcb
commit a63f4115f9
3 changed files with 162 additions and 14 deletions
+2 -1
View File
@@ -201,7 +201,8 @@ impl App {
/// We re-render so horizontal rules, code block borders, and table widths adapt.
fn handle_resize(&mut self, new_width: u16) {
if let Some(ref content) = self.raw_content.clone() {
let lines = crate::renderer::render_markdown(content, new_width);
// TODO(03-02): use link_records from render_markdown for Tab-cycling navigation
let (lines, _link_records) = crate::renderer::render_markdown(content, new_width, None);
let filename = self.filename.clone();
self.document = DocumentState::Loaded { filename, lines };
// Clamp scroll to new max after re-render