public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* changing format of --numbered-sections
@ 2021-04-27  4:32 Tim
       [not found] ` <676ca0f1-1c1f-49c8-afec-c6453c4d298en-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Tim @ 2021-04-27  4:32 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 963 bytes --]

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?

-- 
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/676ca0f1-1c1f-49c8-afec-c6453c4d298en%40googlegroups.com.

[-- Attachment #1.2: Type: text/html, Size: 1382 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: changing format of --numbered-sections
       [not found] ` <676ca0f1-1c1f-49c8-afec-c6453c4d298en-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2021-04-27  6:27   ` Albert Krewinkel
       [not found]     ` <87y2d48cox.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Albert Krewinkel @ 2021-04-27  6:27 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: changing format of --numbered-sections
       [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>
  0 siblings, 1 reply; 5+ messages in thread
From: Tim @ 2021-04-27  6:33 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 2051 bytes --]

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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.

[-- Attachment #1.2: Type: text/html, Size: 2877 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: changing format of --numbered-sections
       [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>
  0 siblings, 1 reply; 5+ messages in thread
From: Albert Krewinkel @ 2021-04-27  6:37 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw


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

> 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 ?

Whoops, I misread your question. This should do:

``` {=html}
<style>
.header-section-number::after {
  content: '.';
}
</style>
```


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: changing format of --numbered-sections
       [not found]             ` <87wnso8c7s.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
@ 2021-04-27  6:47               ` Tim
  0 siblings, 0 replies; 5+ messages in thread
From: Tim @ 2021-04-27  6:47 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 1057 bytes --]

Great: this works perfectly.  Thank you very much.

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

>
> Tim <tim.a...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:
>
> > 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 ?
>
> Whoops, I misread your question. This should do:
>
> ``` {=html}
> <style>
> .header-section-number::after {
> content: '.';
> }
> </style>
> ```
>
>
> -- 
> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/ab79deaa-b50e-4f48-b712-708ca7b3a2b0n%40googlegroups.com.

[-- Attachment #1.2: Type: text/html, Size: 1742 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-04-27  6:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-27  4:32 changing format of --numbered-sections Tim
     [not found] ` <676ca0f1-1c1f-49c8-afec-c6453c4d298en-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2021-04-27  6:27   ` Albert Krewinkel
     [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

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).