-
Notifications
You must be signed in to change notification settings - Fork 28
fix(renderer): occasional parts rendering, markdown types #83
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
Conversation
It seems like the markdown rendering plugins get confused by nested code fences so we replace embedded fences with ` ` `
be49c31 to
c1e625a
Compare
Instead of disabling embedded markdown rendering, we can use a longer outer codefence. It did require regenerating all of the test data.
Instead of just using the filename extension, use the neovim filetype (with some specific overrides). Fall back to the filename extension. This means we render our markdown sections with `markdown` as the type instead of `md` and that enables rendering embedded codefences correctly. Hopefully the last fix on this :)
Seems like nightly returns text as the type for .txt files which breaks our tests
This was a subtle one and it only shows up when we're not collapsing events so it wasn't caught by the unit tests. I've since modified the unit tests to also run the replays without collapsing to catch bugs like this in the future. If the first version of a part didn't result in something being rendered, future updates to that part would also not render anything. This was particularly likely to happen with tools as the first version of the part is often `step-start`. Because we didn't think this was a new part, we called `_replace_part_in_buffer` but that exits quickly because the part hadn't been rendered anywhere. While we could try to call `_insert_part_to_buffer` in `_replace_part_in_buffer` if the part hadn't been rendered, that would miss some subtle cases around error handling so the correct fix is consider the part new in `on_part_updated` if we haven't rendered it before.
|
@sudo-tee This one is probably a little urgent so would love a review when you have time. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a great fix.
Thanks you for this
There is a small conflict with main, once it's resolved I will merge
|
I'm sorry I think I messed up the conflict resolution with the github UI. |
|
no worries, i can take a look in a few hours. fwiw, the GH UI merges have let me down before so I've stopped doing merges there. also, if you'd rather i can just rebase my changes on main and resubmit the pr? |
Yes that would probably be easier to just rebase and drop the merge commit I did |
This started out as a smaller bugfix but along the way I noticed that sometimes parts were not rendering, so that's the more important issue, from: 4317d0b:
This was a subtle one and it only shows up when we're not collapsing
events so it wasn't caught by the unit tests. I've since modified the
unit tests to also run the replays without collapsing to catch bugs like
this in the future.
If the first version of a part didn't result in something being
rendered, future updates to that part would also not render anything.
This was particularly likely to happen with tools as the first version
of the part is often
step-start. Because we didn't think this was anew part, we called
_replace_part_in_bufferbut that exits quicklybecause the part hadn't been rendered anywhere.
While we could try to call
_insert_part_to_bufferin_replace_part_in_bufferif the part hadn't been rendered, that wouldmiss some subtle cases around error handling so the correct fix is
consider the part new in
on_part_updatedif we haven't rendered itbefore.
Now, onto the issue that started this PR:
I noticed that embedded codefences were screwing up our rendering. At first, I thought we needed to escape/replace them but then I realized we could use a longer codefence for our outer wrapper. I also realized that we weren't setting the markdown types correctly (markdown should be
markdownnotmd). Setting the codefence tomarkdownenables render-markdown to render embedded codefences correctly.Before:
After (the codefence is normally hidden, I just have the cursor there to show the longer codefence and correct type)