0

I'm trying to use the Markwon markdown library. https://noties.io/Markwon/

On my screen, list bullets are rendering too large.

enter image description here

(And also not centered).

I'm wondering if there's a way to style the bullets?

halfer
  • 19,824
  • 17
  • 99
  • 186
Jeffrey Blattman
  • 22,176
  • 9
  • 79
  • 134
  • Some stuff [here](https://noties.io/Markwon/docs/v4/core/theme.html#list), though I do not know if they will help your use case. – CommonsWare Jul 03 '20 at 21:51
  • 1
    It looks like you can specify a bullet width through a [custom `MarkwonTheme`](https://noties.io/Markwon/docs/v4/core/theme.html). The `MarkwonTheme.Builder` there has a `bulletWidth(int)` method that takes a measure in pixels. – Mike M. Jul 03 '20 at 21:52
  • Yeah I saw that. It saws "The width of the bullet item". Doesn't sound like what I want but I'll try it. – Jeffrey Blattman Jul 03 '20 at 21:57
  • 1
    I went through the code. It's the width of the circle, if that's what you're wondering. – Mike M. Jul 03 '20 at 21:58
  • If that doesn't work for you, for whatever reason, the sample app there has a example of how to completely customize that, as it were: https://github.com/noties/Markwon/blob/master/sample/src/main/java/io/noties/markwon/sample/notification/NotificationActivity.java#L129. That's overriding the library's built-in span type for lists, and returning a platform `BulletSpan`, so that it will work in a `Notification`. I would assume that you could return whatever custom `CharacterStyle` you like, there. – Mike M. Jul 03 '20 at 22:03
  • @MikeM please write a quick answer so I can accept. Thanks. – Jeffrey Blattman Jul 03 '20 at 22:07
  • Oh, I'm good. If that worked for you, please feel free to post an answer to show the proper usage. I've never used that library before, and I think I was misreading the documentation anyway. Thank you, though. I appreciate the offer. Cheers! – Mike M. Jul 03 '20 at 23:44

1 Answers1

2

Answer was provided by Mike M. in comments.

It looks like you can specify a bullet width through a custom MarkwonTheme. The MarkwonTheme.Builder there has a bulletWidth(int) method that takes a measure in pixels.

final Markwon markwon = Markwon.builder(getContext())
    .usePlugin(new AbstractMarkwonPlugin() {
      @Override
      public void configureTheme(@NonNull MarkwonTheme.Builder builder) {
        builder.bulletWidth(6); // pixels
      }
    })
    .build();

This is for Markwon 4.4.0.

Jeffrey Blattman
  • 22,176
  • 9
  • 79
  • 134