Args: text: The markdown formatted text, use triple-quotes, (`\"\"\"# My Title\"\"\"`) to create multi-line markdown text file: Path to a file containing markdown text name: A unique name for the block to reference when adding text or embedding (optional)
(self, text: str = None, file: NPath = None, name: BlockId = None, label: str = None)
| 42 | _tag = "Text" |
| 43 | |
| 44 | def __init__(self, text: str = None, file: NPath = None, name: BlockId = None, label: str = None): |
| 45 | """ |
| 46 | Args: |
| 47 | text: The markdown formatted text, use triple-quotes, (`\"\"\"# My Title\"\"\"`) to create multi-line markdown text |
| 48 | file: Path to a file containing markdown text |
| 49 | name: A unique name for the block to reference when adding text or embedding (optional) |
| 50 | label: A label used when displaying the block (optional) |
| 51 | |
| 52 | !!! note |
| 53 | File encodings are auto-detected, if this fails please read the file manually with an explicit encoding and use the text parameter on dp.Attachment |
| 54 | """ |
| 55 | if text: |
| 56 | text = textwrap.dedent(text).strip() |
| 57 | |
| 58 | assert text or file |
| 59 | content = text or utf_read_text(Path(file).expanduser()) |
| 60 | super().__init__(content=content, name=name, label=label) |
| 61 | |
| 62 | def format(self, *args: BlockOrPrimitive, **kwargs: BlockOrPrimitive) -> Group: |
| 63 | """ |