LibMarkdown: Turn absolute links into hyperlinks in terminal output :^)

I'm not completely sure how to handle this nicely for relative links
but it would be nice to do that too.
This commit is contained in:
Andreas Kling 2020-05-09 16:23:05 +02:00
parent 00b87167fe
commit 4330046aff
Notes: sideshowbarker 2024-07-19 06:48:38 +09:00

View file

@ -149,6 +149,14 @@ String Text::render_for_terminal() const
builder.append('m');
}
if (!span.style.href.is_null()) {
if (strstr(span.style.href.characters(), "://") != nullptr) {
builder.append("\033]8;;");
builder.append(span.style.href);
builder.append("\033\\");
}
}
builder.append(span.text.characters());
if (needs_styling)
@ -160,6 +168,7 @@ String Text::render_for_terminal() const
// chance to follow them anyway.
if (strstr(span.style.href.characters(), "://") != nullptr) {
builder.appendf(" <%s>", span.style.href.characters());
builder.append("\033]8;;\033\\");
}
}
if (!span.style.img.is_null()) {