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

Avoid exception when unclosed directive container is found within another container and chunkDocument is empty (fixes #16, fixes micromark/micromark#173). #27

Closed
wants to merge 1 commit into from

Conversation

DavidAnson
Copy link

Initial checklist

  • I read the support docs
  • I read the contributing guide
  • I agree to follow the code of conduct
  • I searched issues and couldn’t find anything (or linked relevant results below)
  • If applicable, I’ve added docs and tests

Description of changes

Avoid exception when unclosed directive container is found within another container and chunkDocument is empty (fixes #16, fixes micromark/micromark#173).

I tried for a while to parse the scenario successfully, but couldn't find a way to avoid creating an empty container that didn't break one of the existing "lazy" tests. As it is already an edge-case scenario, giving up like this seems okay to me - definitely better than crashing callers. :)

@github-actions github-actions bot added 👋 phase/new Post is being triaged automatically 🤞 phase/open Post is being triaged manually and removed 👋 phase/new Post is being triaged automatically labels Sep 18, 2024
Copy link

codecov bot commented Sep 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (7f23ba8) to head (b85e704).
Report is 8 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main       #27   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            9         9           
  Lines         1416      1365   -51     
=========================================
- Hits          1416      1365   -51     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

This comment has been minimized.

@wooorm
Copy link
Member

wooorm commented Sep 19, 2024

Thanks for working on this!

I appreciate that errors are not nice. Still, I believe that we must strive towards correctness.
You’re silencing an error, and introducing an incorrect result.

I spent some time with the code and introduced a proper fix.

@wooorm wooorm added 🐛 type/bug This is a problem 💪 phase/solved Post is done labels Sep 19, 2024
@github-actions github-actions bot removed the 🤞 phase/open Post is being triaged manually label Sep 19, 2024
@wooorm
Copy link
Member

wooorm commented Sep 19, 2024

Released in 3.0.2!

@DavidAnson
Copy link
Author

Love it, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💪 phase/solved Post is done 🐛 type/bug This is a problem
2 participants