From 86f8c7686c69a211811258d251c4dba1c8bf154e Mon Sep 17 00:00:00 2001 From: facelessuser Date: Wed, 16 Oct 2024 08:03:11 -0600 Subject: [PATCH] Provide a sane result for manual and level depth setting 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. --- pymdownx/blocks/caption.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pymdownx/blocks/caption.py b/pymdownx/blocks/caption.py index 58ecfb8f0..c2ebd48cc 100644 --- a/pymdownx/blocks/caption.py +++ b/pymdownx/blocks/caption.py @@ -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,