Hello, I am trying to write a filter to find all code blocks and wrap them into a custom `.docx` style. This is what I tried:

if type(elem) == pf.CodeBlock:
        return pf.Div(elem, attributes={'custom-style': 'Source Code Boxed'})

However, that doesn't work - it seems that the syntax highlighting styles override my desired `'Source Code Boxed'` style. I found a workaround, but it is ugly, and loses all the syntax highlighting:

if type(elem) == pf.CodeBlock:
    elemStr = pf.stringify(elem)
    lines = [pf.LineItem(pf.Str(x)) for x in elemStr.splitlines()]
    return pf.Div(pf.LineBlock(*lines), 
            attributes={ 'custom-style': 'Source Code Boxed'})

The above works (it surrounds my code block in a box in my final `.docx` output), but all syntax highlighting is lost.

**Is there a way to achieve my desired result?** I would the code being surrounded in a box (thanks to my `'Source Code Boxed'` style), but still retain its syntax highlighting.

I have the same problem with TableCell, by the way.

--
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 view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/7f65d550-17ce-474a-b830-31ff8b1d78b3%40googlegroups.com.