commit 6a0c46aa50e96249f1a1c05ddf19f9c9a6a72e9c from: Murilo Ijanc date: Fri Apr 10 23:12:47 2026 UTC render links as OSC 8 hyperlinks for terminal click support commit - f0385e45c78990de3039bd8ccf4f19714cb8c4ba commit + 6a0c46aa50e96249f1a1c05ddf19f9c9a6a72e9c blob - 43f89f433f8e39eb591076c361f8451c73cbad8e blob + bbff52568021b91084c34eafb4f02da858d4523c --- README.md +++ README.md @@ -2,9 +2,11 @@ tmdr - Tiny Markdown Reader ================================== tmdr is a tiny markdown terminal reader written in Rust. It renders headings, paragraphs, lists, code blocks, bold, -italic, and inline code directly in the terminal. +italic, inline code, and links (OSC 8) directly in the terminal. +![tmdr screenshot](tmdr.png) + Requirements ------------ In order to build tmdr you need rustc. blob - 70a54755de0dd103c40033671267e6764d8ce8b9 blob + eba3fba58f9ac8c4515984a5efa0c53647ce1349 --- example.md +++ example.md @@ -43,6 +43,11 @@ main(void) } ``` +## Links + +Visit [OpenBSD](https://www.openbsd.org) for more info. +A [link with **bold**](https://example.com) inside a paragraph. + ## Headers ### Level 3 blob - 46721e3c203de1b22328c738ff5d2ff07fd51193 blob + 33df2adde1a59722af69e1600471f021f9288f27 --- tmdr.rs +++ tmdr.rs @@ -171,7 +171,14 @@ fn inline_text(nodes: &[Node]) -> String { Node::InlineCode(c) => out.push_str(&c.value), Node::Break(_) => out.push('\n'), Node::Link(l) => { - out.push_str(&inline_text(&l.children)); + let text = inline_text(&l.children); + out.push_str("\x1b]8;;"); + out.push_str(&l.url); + out.push_str("\x1b\\"); + out.push_str(UL); + out.push_str(&text); + out.push_str(RESET); + out.push_str("\x1b]8;;\x1b\\"); } Node::Image(img) => out.push_str(&img.alt), _ => {}