Create Text instance from markup. Args: text (str): A string containing console markup. style (Union[str, Style], optional): Base style for text. Defaults to "". emoji (bool, optional): Also render emoji code. Defaults to True. emoji_variant (
(
cls,
text: str,
*,
style: Union[str, Style] = "",
emoji: bool = True,
emoji_variant: Optional[EmojiVariant] = None,
justify: Optional["JustifyMethod"] = None,
overflow: Optional["OverflowMethod"] = None,
end: str = "\n",
)
| 258 | |
| 259 | @classmethod |
| 260 | def from_markup( |
| 261 | cls, |
| 262 | text: str, |
| 263 | *, |
| 264 | style: Union[str, Style] = "", |
| 265 | emoji: bool = True, |
| 266 | emoji_variant: Optional[EmojiVariant] = None, |
| 267 | justify: Optional["JustifyMethod"] = None, |
| 268 | overflow: Optional["OverflowMethod"] = None, |
| 269 | end: str = "\n", |
| 270 | ) -> "Text": |
| 271 | """Create Text instance from markup. |
| 272 | |
| 273 | Args: |
| 274 | text (str): A string containing console markup. |
| 275 | style (Union[str, Style], optional): Base style for text. Defaults to "". |
| 276 | emoji (bool, optional): Also render emoji code. Defaults to True. |
| 277 | emoji_variant (str, optional): Optional emoji variant, either "text" or "emoji". Defaults to None. |
| 278 | justify (str, optional): Justify method: "left", "center", "full", "right". Defaults to None. |
| 279 | overflow (str, optional): Overflow method: "crop", "fold", "ellipsis". Defaults to None. |
| 280 | end (str, optional): Character to end text with. Defaults to "\\\\n". |
| 281 | |
| 282 | Returns: |
| 283 | Text: A Text instance with markup rendered. |
| 284 | """ |
| 285 | from .markup import render |
| 286 | |
| 287 | rendered_text = render(text, style, emoji=emoji, emoji_variant=emoji_variant) |
| 288 | rendered_text.justify = justify |
| 289 | rendered_text.overflow = overflow |
| 290 | rendered_text.end = end |
| 291 | return rendered_text |
| 292 | |
| 293 | @classmethod |
| 294 | def from_ansi( |