I think this almost does the trick, but the colon is appearing at the end of the heading:

1 FirstHeading.

whereas I wanted it just after the number 1.

Is there a way to change it ?

On Tuesday, 27 April 2021 at 16:27:18 UTC+10 Albert Krewinkel wrote:

Tim <tim.a...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:

> I am converting markdown to html using pandoc with an associated simple CSS.
>
> Currently, the numbered headings appear as:
>
> 1 FirstHeading
> 1.1..
>
> 2 SecondHeading
>
> My aim: I would like to modify the format of the headings very slightly so
> that there is a period after even the H1 headings:
> 1. FirstHeading.
>
> I am *guessing* from looking at the html output that pandoc hardcodes the
> html output for the numbered sections. Am I right therefore in thinking
> that I cannot modify my CSS to achieve my aim.
>
> What then is the easiest way to achieve my aim?

If this is just for HTML, then you could use CSS to add the period.

Putting the following anywhere in your input Markdown should do the
trick:

```{=html}
<style>
h1::after, h2::after, h3::after, h4::after, h5::after, h6::after {
content: '.';
}
</style>
```

If you also need to target different output, then I'd suggest using a
pandoc Lua filter. Put the following in a file `heading-periods.lua`
and run with `pandoc --lua-filter heading-periods.lua`

``` lua
function Header (h)
h.content = h.content:insert(pandoc.Str '.')
return h
end
```

HTH,
Albert


--
Albert Krewinkel
GPG: 8eed e3e2 e8c5 6f18 81fe e836 388d c0b2 1f63 1124

--
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/aaadb65c-3cca-497f-94b7-059013c62811n%40googlegroups.com.