Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTML comment parsing -- nbsphinx works, myst-nb hangs with repeated warning #94

Closed
wants to merge 3 commits into from

Conversation

phaustin
Copy link
Contributor

I'm moving one of my courses from nbsphinx to myst-nb, and have hit an issue with a commented link causing myst to hang. Specifically, this line is ignored by nbsphinx, but causes the myst parser to go into an infinite loop printing the message:

"WARNING: /Users/phil/repos/MyST-NB/docs/examples/austin_issue/lab7/lab7.ipynb:2:1 {'cell_index': 28} ignoring duplicate link definition 'lab7:prob:staggered'"

@phaustin phaustin mentioned this pull request Mar 21, 2020
},
"source": [
"### Problem One\n",
"[lab7:prob:staggered]:(#Problem-One) \n",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@phaustin thanks for the feedback

I'm moving one of my courses from nbsphinx to myst-nb, and have hit an issue with a commented link causing myst to hang. Specifically, this line is ignored by nbsphinx, but causes the myst parser to go into an infinite loop printing the message:

"WARNING: /Users/phil/repos/MyST-NB/docs/examples/austin_issue/lab7/lab7.ipynb:2:1 {'cell_index': 28} ignoring duplicate link definition 'lab7:prob:staggered'"

Ok, firstly @choldgraf note how the warning gives the correct notebook cell and line number 😄 (this is currently only for the source -> Markdown AST phase, not the Markdown -> docutils AST phase).

Secondly, going by the warning message, the error actually lies here, not to where you linked to. Checking it with mistletoe (the markdown parser), it does replicate this error:

$ mistletoe
mistletoe [version 0.10.0] (interactive)
Type Ctrl-D to complete input, or Ctrl-C to exit.
>>> [lab7:prob:staggered]:(#Problem-One) 
... > Modify
:2:1 ignoring duplicate link definition 'lab7:prob:staggered'
...

The issue lies in the transition from link definition to quote block , somewhere around here: https://github.com/ExecutableBookProject/mistletoe-ebp/blob/d7247b52df3ff50dc71aef9ec3f8e7b316b03813/mistletoe/block_tokens.py#L821

This is only caused if there is no new line between the link definition and the quote,
whereby the line number for some reason is not being progressed (so it reads the same line infinitely)

As a stop gap, if you add a blank line, there should be no problem:

[lab7:prob:staggered]:(#Problem-One)

> ...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep see executablebooks/mistletoe-ebp#13

Literally if you just change [lab7:prob:staggered]:(#Problem-One) \n to [lab7:prob:staggered]:(#Problem-One)\n, then it is ok!?

@phaustin
Copy link
Contributor Author

moved to /executablebooks/mistletoe-ebp#13

@phaustin phaustin closed this Mar 22, 2020
@phaustin phaustin deleted the link_problem branch March 22, 2020 04:26
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.

None yet

2 participants