-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
[JEWEL-746] Load inline markdown images using Coil3 #2924
base: master
Are you sure you want to change the base?
Conversation
b0ba3c3
to
7fdb5ac
Compare
They look like entirely different images... Are you sure it's the same image it's being displayed, and that it's loading correctly in the first case? That to me looks like a "broken image" placeholder (which also is way too big) SVG files have an intrinsic size declared in their root node, and any renderer should adhere to that |
images I posted earlier are examples of how JCEF renders my "README.md" which this is how compose shows the same things: |
I see. I had misinterpreted the original message, sorry 🙏 The first image (the broken square) has a declared size of 800x800 px, encoded as As for the latter, I think it's because the text for whatever reason just doesn't get rendered: <g text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11">
<use x="5.5" y="2" fill="#010101" fill-opacity=".3" href="#logo" />
<use x="5.5" y="1" fill="#fff" href="#logo" />
<text x="40.5" y="15" fill="#010101" fill-opacity=".3">build</text>
<text x="40.5" y="14" fill="#fff">build</text>
<text x="83.5" y="15" fill="#010101" fill-opacity=".3">passing</text>
<text x="83.5" y="14" fill="#fff">passing</text>
</g> Again, possibly some unsupported value in there that Skia ignores. That's sort of weird since Skia can interpret image sizes with units, and render text — it does in Chrome! But maybe there is some setup that is missing, or Chrome does some magic stuff. Either way, these are either CMP or Skiko bugs :) |
I'm going to create a separate issue for SVG regressions. Should it go to youtrack? |
.../core/src/main/kotlin/org/jetbrains/jewel/markdown/rendering/DefaultMarkdownBlockRenderer.kt
Outdated
Show resolved
Hide resolved
Please, no. Stick with GH until further notice. You'll know together with everyone else when YT is usable. We're still waiting. |
platform/jewel/markdown/core/src/main/kotlin/org/jetbrains/jewel/markdown/Markdown.kt
Outdated
Show resolved
Hide resolved
platform/jewel/markdown/core/src/main/kotlin/org/jetbrains/jewel/markdown/Markdown.kt
Outdated
Show resolved
Hide resolved
...l/markdown/core/src/main/kotlin/org/jetbrains/jewel/markdown/processing/MarkdownProcessor.kt
Outdated
Show resolved
Hide resolved
...core/src/main/kotlin/org/jetbrains/jewel/markdown/rendering/DefaultInlineMarkdownRenderer.kt
Outdated
Show resolved
Hide resolved
.../core/src/main/kotlin/org/jetbrains/jewel/markdown/rendering/DefaultMarkdownBlockRenderer.kt
Outdated
Show resolved
Hide resolved
.../core/src/main/kotlin/org/jetbrains/jewel/markdown/rendering/DefaultMarkdownBlockRenderer.kt
Outdated
Show resolved
Hide resolved
.../core/src/main/kotlin/org/jetbrains/jewel/markdown/rendering/DefaultMarkdownBlockRenderer.kt
Outdated
Show resolved
Hide resolved
.../core/src/main/kotlin/org/jetbrains/jewel/markdown/rendering/DefaultMarkdownBlockRenderer.kt
Show resolved
Hide resolved
Out of curiosity, have you filed the issues for SVG rendering? I think the size one is caused by https://github.com/coil-kt/coil/blob/main/coil-svg/src/commonMain/kotlin/coil3/svg/SvgDecoder.kt#L39 this parameter being true by default. Ideally, users should be able to override the Coil loader with one they want, but we can keep it for a follow up (it'd be nice to have an issue tracking this in our YouTrack, if you can file it). The text one is the more baffling one. If you can look into it, maybe you can figure out what is the cause, or at least where it should happen, and file an issue for that in the right place. |
@obask ping |
Thanks for doing initial investigation. I filed a tracking issue, but not the one in a coil repository yet. |
96b68a0
to
a415d3d
Compare
It supports every image as an inline node; Using built-in coroutine library and ktor2 from the platform; Added SVG support using a coil dependency.
ok, so IDEA dev(build from master) and the standalone sample works, but IDE sample uses an older version of the plarform:
So if we want to make it work in the sample, we have to add some small workaround there without affecting other modes. |
@rock3r Let me know what do you think is the right thing here given that we don't want to break 24.3 compatibility. The current master is pointing to 2025.2 EAP, so simply waiting may not be sufficient to get this working in older version of IDEA without workarounds. As I mentioned in the thread, I think that previous implementation was ok, as it will only change images rendering in markdown if user specifies their own image loader. But if their loader works correctly, it will probably be able to render markdown images too as we don't really overwrite an image loader provider if it exists. |
It supports every image as an inline node