Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Updates mistune to v3, which resulted in a pretty big refactor being required.
Instead of subclassing
BaseRendererwhich didn't implement any rendering whatsoever, we now subclass the newMarkdownRendererand only adjust the ones we need.Supersedes #777. dependabot could never. c:
Effective changes
For the most part, everything works the same. I did some snapshot testing with the latest 100 issue/pr descriptions in astral-sh/ruff, and all the changes are either whitespace-only, or as follows:
Most importantly, the list renderer now handles some lists better, and reuses parts of mistune's own list item rendering for simplicity.
Task lists (i.e.
- [x] blahitems)don't work anymore. This is due to renderer changes1, and reimplementing rendering for them isn't trivial due to a bug - Markdown Renderer does not properly render Task Lists with task list plugin lepture/mistune#340task_list_item, this does not work due to the reasons outlined in the initial issue description. Basically, with howMarkdownRenderer's list rendering works right now, it's fully self-contained and has no knowledge of task lists, and it does not call back to the block renderer that dynamically dispatches token rendering. Unfortunate.mistune.renderers._list._render_list_item, not sureA probably(?) less important side effect is that newlines between non-rendered elements like HTML or images are now retained, which can result in a bunch of consecutive newlines that would've otherwise been interspersed with HTML tags or image tags. Not sure if/how to fix this.
Footnotes
basically,
MarkdownRendererdoes not implement rendering for any plugin-provided directives. This is also the reason why we e.g. reimplementstrikethroughrendering, since it's provided by a plugin. ↩