Struct StyledText

Struct Documentation

struct StyledText

Styled text that has been parsed and separated into paragraphs.

Use StyledText::from_markdown() to parse a markdown string, or StyledText::from_plain_text() to wrap plain text without formatting.

Assign the result to a styled-text property in a Slint component to display it.

Public Functions

inline StyledText()

Creates a default (empty) styled text.

inline ~StyledText()

Destroys this StyledText.

inline StyledText(const StyledText &other)

Creates a new StyledText from other.

inline StyledText &operator=(const StyledText &other)

Assigns other to this styled text and returns a reference to this styled text.

inline StyledText &operator=(StyledText &&other)

Move-assigns other to this StyledText instance.

Public Static Functions

static inline StyledText from_plain_text(std::string_view text)

Creates styled text from plain text without applying markdown parsing.

static inline std::optional<StyledText> from_markdown(std::string_view markdown)

Parses markdown into styled text.

Returns std::nullopt if the markdown contains unsupported syntax.

Friends

inline friend bool operator==(const StyledText &a, const StyledText &b)

Returns true if a is equal to b; otherwise returns false.