On June 13, 2023 5:16:32 PM EDT, H wrote: >On June 13, 2023 5:00:19 PM EDT, 'William Lupton' via pandoc-discuss > wrote: >>As far as I know, you can't add 'style' attributes. But you can embed >>CSS >>via header-includes. You'll find an example of this if you search the >>manual for 'header-includes' (and you can use a filter to set the >>variable; >>I think Albert gave an example of how to do this a few weeks ago). >> >>On Tue, 13 Jun 2023, 21:37 H, wrote: >> >>> Continuing my quest to write a custom filter, I now ran into a need >>to add >>> attributes to different types of tags as exemplified below: >>> >>> - In header tags such as

, I need to add "style=color: #112233;" >>so it >>> becomes

. >>> >>> - I analogously also need to add style information to tags. >>> >>> In my filter I tried: >>> >>> style_h2 = >>> >>> if (el.level == 2) then >>> local attr = el.attributes >>> attr.insert = style_h2 >>> end >>> >>> but ended up with the below in my html output: >>> >>>

>> data-insert=" style="text-transform: uppercase; color: >>> #cc002b;""> >>> >>> Clearly not the correct way. Can I add the style information as >above >>in a >>> filter, in the pandoc function as I am going through my document >>> block-by-block and modifying the document structure as needed? I >>already >>> adding
with various style information as I iterate over the >>blocks >>> and that works fine but now I need to modify existing tags. >>> >>> I guess I could do it similarly to below but then it applies to all >>eg H2: >>> >>> function Header(el) >>> -- remove header identifier for all levels >>> el.identifier = '' >>> >>> -- convert level 1 and 2 to upper case >>> if (el.level == 1) or (el.level == 2) then >>> return el:walk { >>> Str = function(el) >>> return pandoc.Str(text.upper(el.text)) >>> end >>> } >>> else >>> return el >>> end >>> end >>> >>> How to do it on individual H2 in a filter? >>> >>> Thanks. >>> >>> -- >>> 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 view this discussion on the web visit >>> >>https://groups.google.com/d/msgid/pandoc-discuss/76a72c07-6699-d243-ae20-64808682ec9e%40meddatainc.com >>> . >>> >> >>-- >>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 view this discussion on the web visit >>https://groups.google.com/d/msgid/pandoc-discuss/CAEe_xxgeoT3UjKy0vK2b_w87d-ovNgpL_gRdyDeyb6%2B4SztxQA%40mail.gmail.com. > >I need to stay away from css since the software the output is used in >does not allow css info to be added. Can I "rewrite" a tag in the filter? -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/90C7A30F-C0FA-49D8-B0CD-6521B58113F1%40meddatainc.com.