Add legacy_em extension to Markdown class.
| 18 | |
| 19 | |
| 20 | class LegacyEmExtension(Extension): |
| 21 | """ Add legacy_em extension to Markdown class.""" |
| 22 | |
| 23 | def extendMarkdown(self, md): |
| 24 | """ Register the processor. |
| 25 | |
| 26 | | Class Instance | Registry | Name | Priority | |
| 27 | | ------------------------------------------------------------------ | ---------------------------------------------------------------- | ------------ | :------: | |
| 28 | | [`DelimiterProcessor`][markdown.inlinepatterns.DelimiterProcessor] | [`inlinepatterns`][markdown.inlinepatterns.build_inlinepatterns] | `em_strong` | `60` | |
| 29 | |
| 30 | """ |
| 31 | # flake8: noqa: E501 27-29 |
| 32 | |
| 33 | if md.delimiters is not None: |
| 34 | md.delimiters.add('_', 'strong,em') |
| 35 | else: |
| 36 | md.inlinePatterns.register(DelimiterProcessor('_', 'strong,em', md), 'em_strong', 60) |
| 37 | |
| 38 | def makeExtension(**kwargs): # pragma: no cover |
| 39 | """ Return an instance of the `LegacyEmExtension` """ |