Avoid inline styles inside <code> / <pre> conversion (#117)

* Avoid inline styles inside `<code>` / `<pre>` conversion

The check used for this is analogous to that used to avoid escaping
potential markup characters inside such tags.

Fixes #103

---------

Co-authored-by: AlexVonB <AlexVonB@users.noreply.github.com>
This commit is contained in:
Joseph Myers
2024-04-04 18:55:54 +00:00
committed by GitHub
parent 74ddc408cc
commit 2bd0772685
2 changed files with 23 additions and 0 deletions

View File

@@ -48,6 +48,8 @@ def abstract_inline_conversion(markup_fn):
"""
def implementation(self, el, text, convert_as_inline):
markup = markup_fn(self)
if el.find_parent(['pre', 'code', 'kbd', 'samp']):
return text
prefix, suffix, text = chomp(text)
if not text:
return ''