Skip to content

Commit 6402da1

Browse files
authored
Merge pull request #15 from MoonlightSmile/main
2 parents d7f8307 + 6d08570 commit 6402da1

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

V2exOS/Views/TopicDetail/CommentListView.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,12 @@ struct CommentListView: View {
5757

5858
Markdown(
5959
comment.content
60+
.replacingOccurrences(
61+
of: #"https?.*"#,
62+
with: "[$0]($0)",
63+
options: .regularExpression,
64+
range: nil
65+
)
6066
.replacingOccurrences(
6167
of: #"@(\w+)"#,
6268
with: "[$0](https://www.v2ex.com/member/$1)",

V2exOS/Views/TopicDetail/TopicDetailView.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ struct TopicDetailView: View {
4646
Text(Date(timeIntervalSince1970: TimeInterval(created)).fromNow())
4747
}
4848
}
49+
Link(destination: URL(string: "https://www.v2ex.com/t/\(topic.id)")!) {
50+
Image(systemName: "safari")
51+
Text("在网页中打开")
52+
}
4953

5054
}.foregroundColor(Color(NSColor.secondaryLabelColor))
5155

0 commit comments

Comments
 (0)