commonmark-java icon indicating copy to clipboard operation
commonmark-java copied to clipboard

Change ordering of `node.getNext()` and `context.render(node)` in CoreHtmlRenderer.java

Open silentbaws opened this issue 10 months ago • 3 comments

Getting the next node before rendering the current one prevents a renderer from contextually unlinking the next node.

silentbaws avatar Feb 20 '25 02:02 silentbaws

Hmm, not sure how I feel about unlinking nodes during rendering. Can you explain how you're marking use of this? I'm wondering if it would be better to do this in a preprocessor step (e.g. could replace both nodes with a custom one).

robinst avatar Mar 23 '25 11:03 robinst

Hmm, not sure how I feel about unlinking nodes during rendering. Can you explain how you're marking use of this? I'm wondering if it would be better to do this in a preprocessor step (e.g. could replace both nodes with a custom one).

On mobile so can’t do a full write up of what I’m running in to but the gist is. I’m trying to render obsidian links/images.

I have a custom link processor for that here but this has a side effect of creating nodes that I have to collapse hackily during rendering here.

silentbaws avatar Mar 23 '25 14:03 silentbaws

Hey @silentbaws. Both places you linked are just in CustomLinkProcessor, did you mean to link somewhere else? Do you have an example of what syntax you're trying to parse and how you want to render it? (I had a look at your repo but couldn't see any tests.)

robinst avatar Jun 08 '25 01:06 robinst

Happy to reopen if more information is provided. From what I can tell a PostProcessor should work for your use case.

robinst avatar Jun 22 '25 12:06 robinst