mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 05:58:11 +00:00
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:
parent
00b87167fe
commit
4330046aff
1 changed files with 9 additions and 0 deletions
|
@ -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()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue