Add tables to Markdown.
| 229 | |
| 230 | |
| 231 | class TableExtension(Extension): |
| 232 | """ Add tables to Markdown. """ |
| 233 | |
| 234 | def __init__(self, **kwargs): |
| 235 | self.config = { |
| 236 | 'use_align_attribute': [False, 'True to use align attribute instead of style.'], |
| 237 | } |
| 238 | """ Default configuration options. """ |
| 239 | |
| 240 | super().__init__(**kwargs) |
| 241 | |
| 242 | def extendMarkdown(self, md): |
| 243 | """ Register the processor. |
| 244 | |
| 245 | | Class Instance | Registry | Name | Priority | |
| 246 | | ------------------------------------------------------------- | ---------------------------------------------------------------- | ------ | :------: | |
| 247 | | [`TableProcessor`][markdown.extensions.tables.TableProcessor] | [`blockprocessors`][markdown.blockprocessors.build_block_parser] | `table` | `75` | |
| 248 | |
| 249 | """ |
| 250 | # flake8: noqa: E501 242-244 |
| 251 | if '|' not in md.ESCAPED_CHARS: |
| 252 | md.ESCAPED_CHARS.append('|') |
| 253 | processor = TableProcessor(md.parser, self.getConfigs()) |
| 254 | md.parser.blockprocessors.register(processor, 'table', 75) |
| 255 | |
| 256 | |
| 257 | def makeExtension(**kwargs): # pragma: no cover |
no outgoing calls