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

mdast_util_to_markdown panics while trying to format UTF text with trailing spaces #169

Open
johnlepikhin opened this issue Mar 5, 2025 · 4 comments · May be fixed by #170
Open

mdast_util_to_markdown panics while trying to format UTF text with trailing spaces #169

johnlepikhin opened this issue Mar 5, 2025 · 4 comments · May be fixed by #170

Comments

@johnlepikhin
Copy link

johnlepikhin commented Mar 5, 2025

Hi there,

There is a bug somewhere in state.rs → container_phrasing(), which makes it panic with the message like "byte index 212 is not a char boundary" at line 245. I reproduced it in simple test: johnlepikhin@e4c451a. Please note that source markdown at lines 7-9 contains sequence:

<UTF-8 character> <SPACE> <SPACE> <NEWLINE>
@johnlepikhin
Copy link
Author

Found another case which reproduces probably the same issue: johnlepikhin@3614cbe. The first character in markdown document is UTF-8.

@ChristianMurphy
Copy link
Collaborator

The former might be variation on #31
The latter looks like a variant of #22

@bnchi
Copy link
Contributor

bnchi commented Mar 9, 2025

I was able to reproduce the issue using the second test case you provided and I fixed it in here #170

Can you check if you can reproduce the panic that's happening in the first test case using the fix provided in the PR ?

@johnlepikhin
Copy link
Author

Thank you, @bnchi! Both cases were fixed.

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 a pull request may close this issue.

3 participants