public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* Is there a YAML metadata option for `--shift-heading-level-by` on the command line?
@ 2022-06-06 17:58 R (Chandra) Chandrasekhar
       [not found] ` <c8075c7b-cddd-10ba-f2da-32089bfd62ae-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: R (Chandra) Chandrasekhar @ 2022-06-06 17:58 UTC (permalink / raw)
  To: pandoc-discuss

All my section headings start at level 2, and I wish to number them 
starting at that level, with no numeric prefix.

I am also hoping that I would be able to enshrine my choice in a default 
file.

Is there a YAML metadata option for `--shift-heading-level-by` on the 
command line that could either be used in a defaults file, or in the 
YAML metadata block of the source file??

Thanks.

Chandra


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

* Re: Is there a YAML metadata option for `--shift-heading-level-by` on the command line?
       [not found] ` <c8075c7b-cddd-10ba-f2da-32089bfd62ae-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2022-06-07  8:01   ` R (Chandra) Chandrasekhar
       [not found]     ` <884ca060-dab6-8730-fe09-a46d66238883-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: R (Chandra) Chandrasekhar @ 2022-06-07  8:01 UTC (permalink / raw)
  To: pandoc-discuss

So far, I have succeeded in getting the desired numbering by:

1. Adding

shift-heading-level-by: -1

after the line specifying the reader in my defaults file.

2. Adding

numbersections: true

in the YAML metadata block that specifies the title, etc., in my source 
file.

Thus, I get 1 for the first level-2 heading in my source file. Moreover, 
I can turn the numbering on or off per individual source file from its 
YAML metadata block, rather than having to generate a separate default 
file just for turning section numbering on or off with 1 for level-2 
headings.

However, if I move the line

shift-heading-level-by: -1

from the defaults file to the YAML metadata block in my source file, the 
numbering starts at 0.1 rather than 1 for the first level-2 heading.

Finally, I have found that there are three ways to turn numbering on or off:

(a) to turn section numbering on in the

command line, I need to use

`--number-sections`

(b) to turn it on in the defaults file I need to specify

`number-sections: true`

(c) but to turn it on in the YAML metadata block, I need to specify

`numbersections: true` without an intervening hyphen.

Is this deliberate or an artefact of history?

Chandra
2022-06-07

On 06/06/2022 23:28, R (Chandra) Chandrasekhar wrote:
> All my section headings start at level 2, and I wish to number them 
> starting at that level, with no numeric prefix.
> 
> I am also hoping that I would be able to enshrine my choice in a default 
> file.
> 
> Is there a YAML metadata option for `--shift-heading-level-by` on the 
> command line that could either be used in a defaults file, or in the 
> YAML metadata block of the source file??
> 
> Thanks.
> 
> Chandra


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

* Re: Is there a YAML metadata option for `--shift-heading-level-by` on the command line?
       [not found]     ` <884ca060-dab6-8730-fe09-a46d66238883-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2022-06-07 13:58       ` John MacFarlane
  0 siblings, 0 replies; 3+ messages in thread
From: John MacFarlane @ 2022-06-07 13:58 UTC (permalink / raw)
  To: R (Chandra) Chandrasekhar, pandoc-discuss

"R (Chandra) Chandrasekhar" <chyavana-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:

> So far, I have succeeded in getting the desired numbering by:
>
> 1. Adding
>
> shift-heading-level-by: -1
>
> after the line specifying the reader in my defaults file.
>
> 2. Adding
>
> numbersections: true

This works, because of the way it is implemented for your
output format, but this is not the documented way to set
this option, and it won't work for all output formats.  Instead, use

number-sections: true

in your defaults files.

> However, if I move the line
>
> shift-heading-level-by: -1
>
> from the defaults file to the YAML metadata block in my source file, the 
> numbering starts at 0.1 rather than 1 for the first level-2 heading.

You can't, in general, set command line options from YAML
metadata.  Options are one thing, metadata is another.
Defaults files are where you set options.

> Finally, I have found that there are three ways to turn numbering on or off:
>
> (a) to turn section numbering on in the
>
> command line, I need to use
>
> `--number-sections`
>
> (b) to turn it on in the defaults file I need to specify
>
> `number-sections: true`
>
> (c) but to turn it on in the YAML metadata block, I need to specify
>
> `numbersections: true` without an intervening hyphen.
>
> Is this deliberate or an artefact of history?

The last method works because of an implementation detail,
but this is not a documented or supported way of doing it.


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

end of thread, other threads:[~2022-06-07 13:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-06 17:58 Is there a YAML metadata option for `--shift-heading-level-by` on the command line? R (Chandra) Chandrasekhar
     [not found] ` <c8075c7b-cddd-10ba-f2da-32089bfd62ae-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2022-06-07  8:01   ` R (Chandra) Chandrasekhar
     [not found]     ` <884ca060-dab6-8730-fe09-a46d66238883-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2022-06-07 13:58       ` John MacFarlane

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