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

Incorrect "line 1, column 1" in an "Invalid options YAML: while parsing a block mapping" error #382

Closed
feorlen opened this issue May 22, 2021 · 2 comments · Fixed by #796
Labels
bug Something isn't working

Comments

@feorlen
Copy link

feorlen commented May 22, 2021

This is an informational maybe-bug, I was not able to reproduce it. One of my novice contributors ran into it but resolved it on their own. Perhaps this report will be helpful.

They received the following error, and there was legitimately something wrong with the directive. But it wasn't on "line 1, column 1" as the message stated. It was several lines into the document and indented.

WARNING: Directive 'image': Invalid options YAML: while parsing a block mapping
 in "<unicode string>", line 1, column 1:
  width: 650px
  ^

I was expecting it to say "line 10, column 4" or whatever.

The md file contained something approximately like this. (I was not able to inspect the broken file.) The problem line, or perhaps something nearby, may have contained unexpected whitespace (like a tab?)

## some heading

1. some list item

   '''{image} image.png
       :width: 650px
       :alt: image description
       '''

Environment:

MacOS, probably Catalina

requirements.txt:

sphinx==3.4.0
six>=1.10.0
sphinxcontrib.mermaid>=0.5.0
myst-parser==0.13.3
furo==2021.02.21.beta25
sphinx-copybutton>=0.3.1
sphinx-inline-tabs==2020.10.19b4
@feorlen feorlen added the bug Something isn't working label May 22, 2021
@welcome
Copy link

welcome bot commented May 22, 2021

Thanks for opening your first issue here! Engagement like this is essential for open source projects! 🤗

If you haven't done so already, check out EBP's Code of Conduct. Also, please try to follow the issue template as it helps other community members to contribute more effectively.

If your issue is a feature request, others may react to it, to raise its prominence (see Feature Voting).

Welcome to the EBP community! 🎉

@chrisjsewell
Copy link
Member

Thanks for the feedback! Yeh that's a bit of a pain; the error message comes from the pyyaml package, and it is not possible to parse the line number "offset" to it.
I guess the only potential solution would be to have it pass yaml with a number of blank lines added, so that the error line would line up with the line in the document

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants