Skip to content

Quotes and footnotes error #133

@tylerlozano

Description

@tylerlozano

Problem

Using < to quote more than once in a document with footnotes not right below the reference will error out with the following stack trace:

Traceback (most recent call last):
 File "/Library/Caches/pypoetry/virtualenvs/server-pAX0w1Bw-py3.9/lib/python3.9/site-packages/markdown_it/main.py", line 249, in render
    return self.renderer.render(self.parse(src, env), self.options, env)
  File "/Library/Caches/pypoetry/virtualenvs/server-pAX0w1Bw-py3.9/lib/python3.9/site-packages/markdown_it/main.py", line 233, in parse
    self.core.process(state)
  File "/Library/Caches/pypoetry/virtualenvs/server-pAX0w1Bw-py3.9/lib/python3.9/site-packages/markdown_it/parser_core.py", line 33, in process
    rule(state)
  File "/Library/Caches/pypoetry/virtualenvs/server-pAX0w1Bw-py3.9/lib/python3.9/site-packages/markdown_it/rules_core/block.py", line 14, in block
    state.md.block.parse(
  File "/Library/Caches/pypoetry/virtualenvs/server-pAX0w1Bw-py3.9/lib/python3.9/site-packages/markdown_it/parser_block.py", line 107, in parse
    self.tokenize(state, state.line, state.lineMax)
  File "/Library/Caches/pypoetry/virtualenvs/server-pAX0w1Bw-py3.9/lib/python3.9/site-packages/markdown_it/parser_block.py", line 85, in tokenize
    if state.isEmpty(state.line - 1):
  File "/Library/Caches/pypoetry/virtualenvs/server-pAX0w1Bw-py3.9/lib/python3.9/site-packages/markdown_it/rules_block/state_block.py", line 134, in isEmpty
    return (self.bMarks[line] + self.tShift[line]) >= self.eMarks[line]
IndexError: list index out of range

** Reproduce **
To reproduce try rendering a document with this text using the footnotes plugin:

> b [^1]

Some text

> c

[^1]: d

Expected behavior

Footnotes worked being at the bottom of the document prior to using multiple quotes, as illustrated in the previous code snippet. Just delete one quote and it works again.

Environment

  • python = "^3.8"
  • markdown-it-py = "^0.6.0"
  • Operating System: Mac OS Mojave

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions