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] = class="st">"", |
| 265 | emoji: bool = True, |
| 266 | emoji_variant: Optional[EmojiVariant] = None, |
| 267 | justify: Optional[class="st">"JustifyMethod"] = None, |
| 268 | overflow: Optional[class="st">"OverflowMethod"] = None, |
| 269 | end: str = class="st">"\n", |
| 270 | ) -> class="st">"Text": |
| 271 | class="st">"""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 class="st">"". |
| 276 | emoji (bool, optional): Also render emoji code. Defaults to True. |
| 277 | emoji_variant (str, optional): Optional emoji variant, either class="st">"text" or class="st">"emoji". Defaults to None. |
| 278 | justify (str, optional): Justify method: class="st">"left", class="st">"center", class="st">"full", class="st">"right". Defaults to None. |
| 279 | overflow (str, optional): Overflow method: class="st">"crop", class="st">"fold", class="st">"ellipsis". Defaults to None. |
| 280 | end (str, optional): Character to end text with. Defaults to class="st">"\\\\n". |
| 281 | |
| 282 | Returns: |
| 283 | Text: A Text instance with markup rendered. |
| 284 | class="st">""" |
| 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( |