diff --git a/wikitextparser/_section.py b/wikitextparser/_section.py index 55b011c..50bda6b 100644 --- a/wikitextparser/_section.py +++ b/wikitextparser/_section.py @@ -44,7 +44,7 @@ def level(self, value: int) -> None: if level_diff < 0: new_equals = '=' * abs(level_diff) self.insert(0, new_equals) - self.insert(m.end(2) + 1, new_equals) + self.insert(m.end(2) + abs(level_diff), new_equals) return del self[:level_diff] del self[m.end(2) : m.end(2) + level_diff]