mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-25 05:55:13 +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
Notes:
sideshowbarker
2024-07-19 06:48:38 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/4330046aff8
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
Reference in a new issue