diff options
| author | 2020-07-26 15:09:53 +0200 | |
|---|---|---|
| committer | 2020-07-26 15:09:53 +0200 | |
| commit | 6ea6f732e719f93f88588f1d6c435262261e2650 (patch) | |
| tree | 6a2c712aef8e801ecc742e938f14c8b2ff981e0f | |
| parent | Parse NavigableStrings in symbol descriptions. (diff) | |
Fix markdownify's handling of h tags.
Discord only allows `**` for bolding while the markdown from the
default MarkdownConverter tries to use # time n with h*n* tags for
different font weights.
| -rw-r--r-- | bot/cogs/doc/parsing.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/bot/cogs/doc/parsing.py b/bot/cogs/doc/parsing.py index 050c49447..ac8a94e3f 100644 --- a/bot/cogs/doc/parsing.py +++ b/bot/cogs/doc/parsing.py @@ -65,6 +65,10 @@ class _DocMarkdownConverter(MarkdownConverter): bullet = bullets[depth % len(bullets)] return '%s %s\n' % (bullet, text or '') + def convert_hn(self, _n: int, el: PageElement, text: str) -> str: + """Convert h tags to bold text with ** instead of adding #.""" + return f"**{text}**\n\n" + def convert_code(self, el: PageElement, text: str) -> str: """Undo `markdownify`s underscore escaping.""" return f"`{text}`".replace('\\', '') |