Skip to content
Open
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions lib/markdown2.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
12 changes: 6 additions & 6 deletions test/tm-cases/numbering.text
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

<p><img src="https://consequenceofsound.files.wordpress.com/2015/10/screen-shot-2015-10-17-at-6-57-13-pm.png?w=807"</img></p>

<figcaption class="imagenumbers" id="counter-ref-rickroll">Image 1: Let's Rick Roll You</figcaption>
[#imagenumbers Image @rickroll: Let's Rick Roll You]

<p>And we can refer to the rickrolling image as Image <a class="imagenumbers" href="#counter-ref-rickroll">1</a>. There is a second image of something else</p>
And we can refer to the rickrolling image as Image [@rickroll]. There is a second image of something else

<p><img src="https://wonderifyouwonder.files.wordpress.com/2012/02/anchor.jpg"></img></p>

<figcaption class="imagenumbers" id="counter-ref-kent">Figure 2: I for one welcome our new insect overlords</figcaption>
[#imagenumbers Figure @kent: I for one welcome our new insect overlords]

<p>So we can refer to Figure <a class="imagenumbers" href="#counter-ref-rickroll">1</a> and Figure <a class="imagenumbers" href="#counter-ref-kent">2</a> separately.</p>
So we can refer to Figure [@rickroll] and Figure [@kent] separately.

<h1>Here is a table</h1>

Expand All @@ -33,8 +33,8 @@
</tbody>
</table>

<figcaption class="tablenumbers" id="counter-ref-exampletable">Table 1: An example table</figcaption>
[#tablenumbers Table @exampletable: An example table]

<p>Which we can refer to as table <a class="tablenumbers" href="#counter-ref-exampletable">1</a></p>
Which we can refer to as table [@exampletable]

<p>And so we are done.</p>
Loading