diff --git a/CHANGES.md b/CHANGES.md index 10aabd33..25b5a158 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,6 +2,7 @@ ## python-markdown2 2.5.6 (not yet released) +- [pull #770] Fix `numbering` extra dropping the space between the caption text and the number (`Table1` instead of `Table 1`) - [pull #762] Speed up documents with many links by skipping the backslash-escape scan for text without a backslash - [pull #748] Speed up `_unescape_special_chars` by skipping text with no hashes and dropping the full-text comparison per pass (#635) - [pull #749] URL-encode destinations generated by the `link-patterns` extra (#55) diff --git a/lib/markdown2.py b/lib/markdown2.py index d6285404..3f6159ed 100755 --- a/lib/markdown2.py +++ b/lib/markdown2.py @@ -4132,6 +4132,8 @@ def run(self, text: str): continue counter = match.group(1) text_before = match.group(2).strip() + if text_before: + text_before += ' ' ref_id = match.group(3) text_after = match.group(4) number = counters.get(counter, 1) diff --git a/test/tm-cases/numbering.text b/test/tm-cases/numbering.text index 627eef8f..43d5a33b 100644 --- a/test/tm-cases/numbering.text +++ b/test/tm-cases/numbering.text @@ -2,15 +2,15 @@

And we can refer to the rickrolling image as Image 1. There is a second image of something else
+And we can refer to the rickrolling image as Image [@rickroll]. There is a second image of something else
So we can refer to Figure 1 and Figure 2 separately.
+So we can refer to Figure [@rickroll] and Figure [@kent] separately.Which we can refer to as table 1
+Which we can refer to as table [@exampletable]And so we are done.
\ No newline at end of file