public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
From: Albert Krewinkel <albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
Subject: Re: changing format of --numbered-sections
Date: Tue, 27 Apr 2021 08:27:10 +0200	[thread overview]
Message-ID: <87y2d48cox.fsf@zeitkraut.de> (raw)
In-Reply-To: <676ca0f1-1c1f-49c8-afec-c6453c4d298en-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>


Tim <tim.at.ast-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


  parent reply	other threads:[~2021-04-27  6:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-27  4:32 Tim
     [not found] ` <676ca0f1-1c1f-49c8-afec-c6453c4d298en-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2021-04-27  6:27   ` Albert Krewinkel [this message]
     [not found]     ` <87y2d48cox.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
2021-04-27  6:33       ` Tim
     [not found]         ` <aaadb65c-3cca-497f-94b7-059013c62811n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2021-04-27  6:37           ` Albert Krewinkel
     [not found]             ` <87wnso8c7s.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
2021-04-27  6:47               ` Tim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y2d48cox.fsf@zeitkraut.de \
    --to=albert+pandoc-9eawchwdxg8hfhg+jk9f0w@public.gmane.org \
    --cc=pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).