Skip to content

Conversation

@kabir
Copy link

@kabir kabir commented Jan 30, 2025

The NodeRendererMap refuses to write over the existing entries.

Looking a bit into it, it was because MarkdownRenderer.RendererContext iterates over the nodeRenderFactories in reverse order. This means that the last (i.e. the default) one is added first, making it impossible to override.

There were a few ways to fix this, but looking at the corresponding code in TextContentReader.RenderContext and HtmlRenderer.RenderContext, they iterate over the list of factories in the natural order.

@robinst @sebthom if you agree with the fix, it would be great if it could be included in a release soon :-)

kabir added a commit to kabir/langchain4j that referenced this pull request Jan 31, 2025
kabir added a commit to kabir/langchain4j that referenced this pull request Feb 3, 2025
Note that this currently needs a SNAPSHOT of commonmark-java
containing commonmark/commonmark-java#361.
kabir added a commit to kabir/langchain4j that referenced this pull request Feb 3, 2025
This includes the change needed in
commonmark/commonmark-java#361

and removes the previous snapshot
kabir added a commit to kabir/langchain4j that referenced this pull request Feb 3, 2025
This includes the change needed in
commonmark/commonmark-java#361

and removes the previous snapshot
@robinst
Copy link
Collaborator

robinst commented Mar 23, 2025

Thanks @kabir! I wanted some changes around the tests, so raised #368 to fix this instead (the actual fix is the same though).

@robinst robinst closed this Mar 23, 2025
@kabir
Copy link
Author

kabir commented Mar 27, 2025

@robinst Great! Thank you

@robinst
Copy link
Collaborator

robinst commented Jun 22, 2025

@kabir FYI the fix has been released in 0.25.0 now: https://github.com/commonmark/commonmark-java/releases/tag/commonmark-parent-0.25.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants