Hi John, Thanks for the quick reply. Now that you've pointed it out, I can see that: Div Attr [Block ] Means that a div can have attributes, but Table [Inline ] [Alignment ] [Double ] [TableCell ] [[TableCell ]] A table does not have that. I did look at this page, but my next task is to learn how to read this documentation format...! Looks like I'll need to post-process the HTML output with a separate script. On Wednesday, 30 January 2019 14:06:54 UTC-5, John MacFarlane wrote: > > > I don't know anything about PHP, but if you look at > the API docs for Text.Pandoc.Definition, you'll see > that the Table element doesn't have attributes > (including class). > > Best you can do is insert it into a Div with > attributes. > > Ken Dow > writes: > > > Hi, > > > > I'd like to assign a class to every table in my HTML output. I've got > PHP > > filters working but > can't > > figure out how to manipulate the AST to do what I want. > > > > Building on an example PHP filter, I have: > > > > Pandoc_Filter::toJSONFilter(function ($type, $value, $format, $meta) { > > if ('Str' == $type) { > > // use mb_convert_case instead of ucwords so filter works with > > unicode > > return mb_convert_case($value, MB_CASE_LOWER, "UTF-8"); > > } > > if ('Table' == $type) { > > $attrs = array('classes' => 'table'); > > // return ??? > > } > > }); > > > > The 'Str' manipulation works as expected, and any code I put into the > > 'Table' section is executed, but I can't get started on how to proceed > from > > there. Any pointers would be very welcome! > > > > -- > > 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-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org . > > To post to this group, send email to pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > . > > To view this discussion on the web visit > https://groups.google.com/d/msgid/pandoc-discuss/553f3670-7cb1-402f-9a92-89f3774d17c0%40googlegroups.com. > > > For more options, visit https://groups.google.com/d/optout. > -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/b411caba-b372-4f99-aca5-36c5b614c91c%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.