I'm having trouble with writing a pandoc python filter.

When I convert from markdown to docx I'm using a custom reference to set styles.
I can change most of the styles I want, except the bullet style, it isn't supported in the reference file. Default bullets only seem to only use "•" and "-" and repeats. I wanted to add a couple more bullets since my markdown file has a few levels.

If I read the docs correctly, the best way to do that would be to create a custom style and a filter to convert it. (but let me know if there is an easier way)
I made the custom style in the reference doc called "List Bullet" and if I surround my lists with a Div with the class name, it works for the first level at least.

I'm trying to make a python filter, but I am only just learning programming and I only know a very little python. I think this shouldn't be too hard to do, but I'm stuck. I've looked at a couple of the python examples, but I don't quite understand some things.

This is what I have so far. It works only on the first bullet of each list, and I sort of understand why but I do not know how to have it apply to the whole list and sub-lists. I also think I need to call each successive increment "List Bullet 2", "3" and so on.

FYI, got most of the code from the python filter examples on their github.
from pandocfilters import toJSONFilter, BulletList, Div, stringify, attributes

def deflists(key, value, format, meta):
   
   
if key == 'BulletList':
       
# Pretty sure this needs to loop through each value, but not sure how.
       
return Div(["", [], [['custom-style', 'List Bullet']]], value[0])
       
# Is this on the right track? I think I need to recurse through the list?
def toDiv(bullets):
   
return Div(["", [], [['custom-style', 'List Bullet']]], bullets)

if __name__ == "__main__":
    toJSONFilter
(deflists)

--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/b1327704-3fd9-48da-b709-04e9e7267312%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.