-
-
Notifications
You must be signed in to change notification settings - Fork 250
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
Certain characters in inline code incorrectly parsed (e.g., &
)
#372
Comments
\&
` not preserved in parse-render loop\&
not preserved in parse-render loop
\&
not preserved in parse-render loop&
)
We also encountered this. The cause is 8452faf, more specifically this change, I think. |
I also encountered this, originally found in omnilib/sphinx-mdinclude#19. I did some digging and found that the issue lays in Lines 22 to 31 in cb580e8
Some code to reproduce: from urllib.parse import quote
import html
link = "https://sonarcloud.io/api/project_badges/measure?project=Deltares_ddlpy&metric=alert_status"
# code from: def escape_url(link):
safe = (
':/?#@' # gen-delims - '[]' (rfc3986)
'!$&()*+,;=' # sub-delims - "'" (rfc3986)
'%' # leave already-encoded octets alone
)
out_nonhtml = quote(link.encode('utf-8'), safe=safe)
out_withhtml = html.escape(quote(html.unescape(link), safe=safe))
out_withhtml_noescape = quote(html.unescape(link), safe=safe)
print(out_nonhtml)
print(out_withhtml)
print(out_withhtml_noescape) This gives different results. The first one is returned if
Therefore, what I think should fix the issue is to remove the Update for newer mistune versions Lines 32 to 39 in 93fd197
In this case omitting escape does the trick.
|
Also today, in the master branch, |
I'm going down the rabbit hole from jupyter-book > sphinx > myst > ??? here, maybe? I'm getting |
I think what you are encountering is because of the bug described in this issue indeed. No workaround as far as I know, @lepture could you ahare your thoughts on this discussion? |
@itcarroll actually, Jupyter's MyST uses |
@veenstrajelmer I think you've spotted a separate issue. Similar, but independent code paths. The premature HTML-escaping of inline code just uses |
@mentalisttraceur ok fair, but will this issue be resolved? I see limited response from maintainers of this repository, so I am not sure what to expect. If it is a different issue, does it help if I create a different issue, or will it not matter too much? I am a bit hesitant in putting even more investigation time in this package, because of te limited response. My issue is just a single readme badge that does not work in the docs of all my packages (e.g. https://deltares.github.io/dfm_tools). I can relatively easily convert all the readme's from markdown to rst, but only raised this issue since I prefer markdown. |
@veenstrajelmer "not having this discussion here", would matter at least for us that are "actively" participating on this issue 🤷 I would be optimistic - as long as issues don't get "more tangled". |
I was not intending to tangle issues, just noticed this issue that seems pretty much as what I am running into. I do not see how they are caused and therefore also not see how they are unrelated. To me they both come down to incorrect character escaping in mistune, but apparently they have different causes. Either way, I have created another issue here: #394. |
MWE:
Output:
The text was updated successfully, but these errors were encountered: