Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 1 addition & 12 deletions markdown_it/tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ def type(self) -> str:
if self.token:
return self.token.type
assert self.nester_tokens
return _removesuffix(self.nester_tokens.opening.type, "_open")
return self.nester_tokens.opening.type.removesuffix("_open")

@property
def next_sibling(self: _NodeType) -> _NodeType | None:
Expand Down Expand Up @@ -331,14 +331,3 @@ def hidden(self) -> bool:
"""If it's true, ignore this element when rendering.
Used for tight lists to hide paragraphs."""
return self._attribute_token().hidden


def _removesuffix(string: str, suffix: str) -> str:
"""Remove a suffix from a string.

Replace this with str.removesuffix() from stdlib when minimum Python
version is 3.9.
"""
if suffix and string.endswith(suffix):
return string[: -len(suffix)]
return string
Loading