diff options
| author | Gert van Dijk <gertvdijk@gmail.com> | 2022-04-01 23:56:45 +0200 |
|---|---|---|
| committer | Waylan Limberg <waylan.limberg@icloud.com> | 2022-04-18 09:10:02 -0400 |
| commit | ed417a1a555bf2206ceea84ba29ce37322ca8261 (patch) | |
| tree | f870f8b6ff0b26ba2855c5c0925a7883ec79c8b6 /markdown/extensions | |
| parent | f6ca75429562cfa7df333b3529838679e4bfd443 (diff) | |
| download | python-markdown-ed417a1a555bf2206ceea84ba29ce37322ca8261.tar.gz | |
extensions: copy config dict on each highlighted block
This fixes a bug where any subsequent highlighted block with codehilite
would result in the omission of the style setting, because it was popped
off the dict. It would then fall back to pygments_style 'default' after
the first block.
Fixes #1240
Diffstat (limited to 'markdown/extensions')
| -rw-r--r-- | markdown/extensions/codehilite.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/markdown/extensions/codehilite.py b/markdown/extensions/codehilite.py index 1a8761b..a768b73 100644 --- a/markdown/extensions/codehilite.py +++ b/markdown/extensions/codehilite.py @@ -237,11 +237,12 @@ class HiliteTreeprocessor(Treeprocessor): blocks = root.iter('pre') for block in blocks: if len(block) == 1 and block[0].tag == 'code': + local_config = self.config.copy() code = CodeHilite( self.code_unescape(block[0].text), tab_length=self.md.tab_length, - style=self.config.pop('pygments_style', 'default'), - **self.config + style=local_config.pop('pygments_style', 'default'), + **local_config ) placeholder = self.md.htmlStash.store(code.hilite()) # Clear codeblock in etree instance |
