Skip to content

Commit

Permalink
🐛 Fix: undefined variable in reference block (#45)
Browse files Browse the repository at this point in the history
Co-authored-by: Chris Sewell <[email protected]>
  • Loading branch information
asmeurer and chrisjsewell authored Sep 4, 2020
1 parent ee34305 commit 037f253
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion markdown_it/rules_block/reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ def reference(state: StateBlock, startLine, _endLine, silent):
string = state.getLines(startLine, nextLine, state.blkIndent, False).strip()
maximum = len(string)

labelEnd = None
pos = 1
while pos < maximum:
ch = charCodeAt(string, pos)
Expand All @@ -90,7 +91,9 @@ def reference(state: StateBlock, startLine, _endLine, silent):
lines += 1
pos += 1

if labelEnd < 0 or charCodeAt(string, labelEnd + 1) != 0x3A: # /* : */
if (
labelEnd is None or labelEnd < 0 or charCodeAt(string, labelEnd + 1) != 0x3A
): # /* : */
return False

# [label]: destination 'title'
Expand Down

0 comments on commit 037f253

Please sign in to comment.