Skip to content

Keep the space before the number in numbering extra captions - #770

Open
RavSinghChandan wants to merge 1 commit into
trentm:masterfrom
RavSinghChandan:numbering-caption-space
Open

RavSinghChandan wants to merge 1 commit into
trentm:masterfrom
RavSinghChandan:numbering-caption-space

Conversation

@RavSinghChandan

Copy link
Copy Markdown
Contributor

The numbering extra drops the space between the caption text and the number:

>>> markdown2.markdown("[#tablecounter Table @mytable: some interesting stuff]", extras=["numbering"])
'<figcaption class="tablecounter" id="counter-ref-mytable">Table1: some interesting stuff</figcaption>\n'

The wiki page shows Table 1: some interesting stuff for this input. The space was lost in #387 (Regex DOS fixes), which removed the \s* around the text before @ from the regex and added .strip(), so the trailing space went too. The text before @ is now followed by a space when there is one, so [#c @x: caption] still gives 1: caption.

The numbering test case didn't catch this because numbering.text was a copy of the expected HTML, so it never used the extra's syntax. It now has the [#counter text @id ...] definitions and [@id] references that produce numbering.html, which is unchanged; it fails on master.

Added a line to CHANGES.md (I used #770 for the number; I'll correct it if the PR gets another one)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant