Skip to content

Commit

Permalink
Provide a sane result for manual and level depth setting
Browse files Browse the repository at this point in the history
Specifying level depth while using manual mode does not have the context
to provide a relative number and is not recommended. But if it is used,
just return a value of all ones at the specified depth, e.g. 1, 1.1,
1.1.1, etc.
  • Loading branch information
facelessuser committed Oct 16, 2024
1 parent 568dc3b commit 86f8c76
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pymdownx/blocks/caption.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,9 @@ def on_end(self, block):

prefix = self.PREFIX
if prefix and not self.auto:
# Levels should not be used in manual mode, but if they are, give a generic result.
if self.level:
self.fig_num = '.'.join(['1'] * int(self.level))
if self.fig_num:
update_tag(
block,
Expand Down

0 comments on commit 86f8c76

Please sign in to comment.