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

myst_role misparses trailing \ #62

Open
pennae opened this issue Jan 25, 2023 · 1 comment
Open

myst_role misparses trailing \ #62

pennae opened this issue Jan 25, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@pennae
Copy link

pennae commented Jan 25, 2023

Describe the bug

context

myst_role misparses inlines that begin with a role occurences and end with \ because its checks for leading \ unintentionally wraps around the end of srcCharCode and checks the last char code instead.

expectation

>>> md.render("{foo}`ar`\\")
'<p><code class="myst role">{foo}[ar]</code>\\</p>\n'

bug

>>> md.render("{foo}`ar`\\")
'<p>{foo}<code>ar</code>\\</p>\n'

problem
This is a pretty clear misparse that causes rendering errors. admittedly it's not very likely to be hit in the grand scheme of things, but we've hit it nevertheless.

Reproduce the bug

render any string that contains only a myst_role followed by \, with no leading or trailing whitespace.

List your environment

  • markdown_it: 2.1.0
  • mdit_py_plugins: 0.3.3
  • python: 3.10.9
  • OS: nixos unstable
@pennae pennae added the bug Something isn't working label Jan 25, 2023
@welcome
Copy link

welcome bot commented Jan 25, 2023

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! 🎉

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

No branches or pull requests

1 participant