Skip to content

Commit

Permalink
Fix deprecation warnings introduced in latest Python Markdown release (
Browse files Browse the repository at this point in the history
  • Loading branch information
facelessuser committed Mar 31, 2024
1 parent 509e93d commit 722461c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
5 changes: 3 additions & 2 deletions pymdownx/blocks/tab.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from markdown.treeprocessors import Treeprocessor
from .block import Block, type_boolean
from ..blocks import BlocksExtension
import html

HEADERS = {'h1', 'h2', 'h3', 'h4', 'h5', 'h6'}

Expand Down Expand Up @@ -83,8 +84,8 @@ def run(self, doc):

# Generate slugged IDs
for inpt, label in zip(inputs, labels):
text = toc.get_name(label)
innertext = toc.unescape(toc.stashedHTML2text(text, self.md))
innerhtml = toc.render_inner_html(toc.remove_fnrefs(label), self.md)
innertext = html.unescape(toc.strip_tags(innerhtml))
if self.combine_header_slug:
parent_slug = self.get_parent_header_slug(doc, header_map, parent_map, el)
else:
Expand Down
7 changes: 4 additions & 3 deletions pymdownx/tabbed.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
from markdown.extensions import toc
import xml.etree.ElementTree as etree
import re
import html

HEADERS = {'h1', 'h2', 'h3', 'h4', 'h5', 'h6'}

Expand Down Expand Up @@ -184,7 +185,7 @@ def run(self, parent, blocks):
first = False
tab_group = sibling
if self.alternate_style:
index = [index for index, last_input in enumerate(tab_group.findall('input'), 1)][-1]
index = [index for index, _ in enumerate(tab_group.findall('input'), 1)][-1]
for d in tab_group.findall('div'):
if d.attrib['class'] == 'tabbed-labels':
labels = d
Expand Down Expand Up @@ -374,8 +375,8 @@ def run(self, doc):

# Generate slugged IDs
for inpt, label in zip(inputs, labels):
text = toc.get_name(label)
innertext = toc.unescape(toc.stashedHTML2text(text, self.md))
innerhtml = toc.render_inner_html(toc.remove_fnrefs(label), self.md)
innertext = html.unescape(toc.strip_tags(innerhtml))
if self.combine_header_slug:
parent_slug = self.get_parent_header_slug(doc, header_map, parent_map, el)
else:
Expand Down

0 comments on commit 722461c

Please sign in to comment.