Implement rich_text widget and markdown example

This commit is contained in:
Héctor Ramón Jiménez 2024-07-17 22:04:11 +02:00
parent ffb520fb37
commit 910eb72a06
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
11 changed files with 787 additions and 99 deletions

View file

@ -1,6 +1,6 @@
//! Draw paragraphs.
use crate::alignment;
use crate::text::{Difference, Hit, Text};
use crate::text::{Difference, Hit, Span, Text};
use crate::{Point, Size};
/// A text paragraph.
@ -11,6 +11,9 @@ pub trait Paragraph: Sized + Default {
/// Creates a new [`Paragraph`] laid out with the given [`Text`].
fn with_text(text: Text<&str, Self::Font>) -> Self;
/// Creates a new [`Paragraph`] laid out with the given [`Text`].
fn with_spans(text: Text<&[Span<'_, Self::Font>], Self::Font>) -> Self;
/// Lays out the [`Paragraph`] with some new boundaries.
fn resize(&mut self, new_bounds: Size);