Closed AdamGagorik closed 7 months ago
For sure this PR breaks code blocks (some of them render as a single line), so maybe you should not take this change.
A more robust approach, in my opinion, is to trigger the node visitor for descendant elements of the admonition, which confines the behavior to that element type, and doesn't interfere with other block types, e.g. code blocks. I have added an example in which links are properly transformed in the context of an admonition using this approach. Changes are pushed to master
.
I noticed links were not working inside admonitions. This is because we never visit them in the node visitor. I think it should be changed from pre-order depth first search to post-order depth first search. This is just something for you to consider, I don't know the full ramifications of this change without more testing. With the change, I see links inside admonitions are working, but I don't know if it broke something else.