Draft Viewer trait for markdown

This commit is contained in:
Héctor Ramón Jiménez 2025-02-04 07:53:56 +01:00
parent c02ae0c4a4
commit 5655998761
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
9 changed files with 588 additions and 234 deletions

View file

@ -267,25 +267,21 @@ impl Generator {
} => {
let details = {
let title = rich_text![
span(&pull_request.title).size(24).link(
Message::OpenPullRequest(pull_request.id)
),
span(&pull_request.title)
.size(24)
.link(pull_request.id),
span(format!(" by {}", pull_request.author))
.font(Font {
style: font::Style::Italic,
..Font::default()
}),
]
.on_link_clicked(Message::OpenPullRequest)
.font(Font::MONOSPACE);
let description = markdown::view(
description,
markdown::Settings::default(),
markdown::Style::from_palette(
self.theme().palette(),
),
)
.map(Message::UrlClicked);
let description =
markdown::view(&self.theme(), description)
.map(Message::UrlClicked);
let labels =
row(pull_request.labels.iter().map(|label| {
@ -349,11 +345,11 @@ impl Generator {
container(
scrollable(
markdown::view(
preview,
markdown::Settings::with_text_size(12),
markdown::Style::from_palette(
self.theme().palette(),
markdown::Settings::with_text_size(
12,
&self.theme(),
),
preview,
)
.map(Message::UrlClicked),
)