halilozercan/compose-richtext

About support .svg or other format picture (like .gif)

equationl opened this issue · 2 comments

In my project, I need to show .svg picture.

I can easy to edit like this to support:

Edit .\richtext-commonmark\src\androidMain\kotlin\com\halilibo\richtext\markdown\RemoteImage.kt :

val painter = rememberAsyncImagePainter(
  model = ImageRequest.Builder(LocalContext.current)
    .data(data = url)
    .size(Size.ORIGINAL)
    .crossfade(true)
    .build(),
  imageLoader = ImageLoader.Builder(LocalContext.current)
    .components {
      add(SvgDecoder.Factory())
    }
    .build()
)

I can using same way to show .gif, But it just for me.

Is there a way to make this library support optional? Cause not everyone need this.

I really, really need SVG support for a project I'm working on, so I'd like this to be an option in the library as well. Especially since I can't figure out how to get gradle to build richtext as a subproject of my app

You can customize ImageLoader through internal coil mechanism without any changes in library

The singleton ImageLoader can be configured by implementing ImageLoaderFactory on your Application class.