Skip to content

Commit

Permalink
fix: reference-style link will not render if the reference is the las…
Browse files Browse the repository at this point in the history
…t line in file (#197)

* fix: reference-style link will not render if the reference is the last line in file
Fixes #196

Signed-off-by: Frost Ming <[email protected]>

* fix noxfile

Signed-off-by: Frost Ming <[email protected]>
  • Loading branch information
frostming authored Jun 18, 2024
1 parent 6de4293 commit 210e9cd
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## Unreleased

### Fixed

- Reference link will not render if the reference definition doesn't end with newline.

## v2.1.0(2024-06-13)

### Changed
Expand Down
6 changes: 4 additions & 2 deletions marko/inline_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,9 @@ def _parse_link_dest_title(
else:
escaped = False
pairs = 0
i = 0
for i, c in enumerate(link_text[start:], start):
i = start
while i < len(link_text):
c = link_text[i]
if escaped:
escaped = False
elif c == "\\":
Expand All @@ -322,6 +323,7 @@ def _parse_link_dest_title(
return link_dest, _EMPTY_GROUP
else:
raise ParseError("unmatched parenthesis")
i += 1
else:
if is_inline:
raise ParseError("No right parenthesis is found")
Expand Down
2 changes: 1 addition & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
os.environ.update(PDM_IGNORE_SAVED_PYTHON="1")


@nox.session(python=["3.7", "3.8", "3.9", "3.10", "3.11"])
@nox.session(python=["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"])
def tests(session):
session.run("pdm", "install", "-d", external=True)
session.run("pytest", "tests/")
Expand Down

0 comments on commit 210e9cd

Please sign in to comment.