public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* Command line options vs. Options in YAML metadata block
@ 2022-08-21 12:08 name name
       [not found] ` <c755bc3e-1a76-4673-ba61-fa7e3cf9a6can-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: name name @ 2022-08-21 12:08 UTC (permalink / raw)
  To: pandoc-discuss


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

I try to understand how the command line options and the options in the 
YAML metadata blocks work.

This is a test file:

~~~
---
title: title
toc: true
number-sections: true
lot: true
...

# section one

body text

[this is a hyperlink](https://google.com/)

# section two

body text

# section three

Table: This is a table

default      right      right
-------     ------     ------
row 1       1,000,000         10
rr oo ww 2     10,000  1,000,000

Table: This is another table

default      right      right
-------     ------     ------
row 1       1,000,000         10
rr oo ww 2     10,000  1,000,000
~~~

My questions:

1. Why `toc`, `number-sections`, and `lot` in the YAML metadata block
   doesn't work if converting from Markdown to HTML? (Though they work
   if converting from Markdown to PDF.)

2. To have the table of contents if converting from Markdown to HTML,
   I can use a command line option `--table-of-contents`.
   Is there a similar command line option to have list of tables if
   converting from Markdown to HTML?

3. If converting from Markdown to PDF, I can use
   `-V links-as-notes` to have hyperlinks printed as footnotes. Is there
   a better way?

   And is it possible to show hyperlinks as footnotes if converting from
   Markdown to HTML?

-- 
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/c755bc3e-1a76-4673-ba61-fa7e3cf9a6can%40googlegroups.com.

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

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

* Re: Command line options vs. Options in YAML metadata block
       [not found] ` <c755bc3e-1a76-4673-ba61-fa7e3cf9a6can-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2022-08-22 16:39   ` John MacFarlane
       [not found]     ` <5BB122BF-5CC4-4DA0-836D-09FB4BE2A3C7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: John MacFarlane @ 2022-08-22 16:39 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw



> On Aug 21, 2022, at 5:08 AM, name name <ivan20151013-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> 
> I try to understand how the command line options and the options in the YAML metadata blocks work.
> 
> This is a test file:
> 
> ~~~
> ---
> title: title
> toc: true
> number-sections: true
> lot: true
> ...
> 
> # section one
> 
> body text
> 
> [this is a hyperlink](https://google.com/)
> 
> # section two
> 
> body text
> 
> # section three
> 
> Table: This is a table
> 
> default      right      right
> -------     ------     ------
> row 1       1,000,000         10
> rr oo ww 2     10,000  1,000,000
> 
> Table: This is another table
> 
> default      right      right
> -------     ------     ------
> row 1       1,000,000         10
> rr oo ww 2     10,000  1,000,000
> ~~~
> 
> My questions:
> 
> 1. Why `toc`, `number-sections`, and `lot` in the YAML metadata block
>    doesn't work if converting from Markdown to HTML? (Though they work
>    if converting from Markdown to PDF.)

All metadata variables automatically populate template variables when templates are being filled in. In some formats, `toc` is used as a template variable to trigger inclusion of a certain command (`\tableofcontents` in the case of LaTeX). But in other formats, the TOC can't be produced by a command; we need to build it in the writer.  So, it's just an accident that it works in some formats.  Don't rely on this.

> 
> 2. To have the table of contents if converting from Markdown to HTML,
>    I can use a command line option `--table-of-contents`.
>    Is there a similar command line option to have list of tables if
>    converting from Markdown to HTML?

Not currently, but it would be a nice feature to add.
https://github.com/jgm/pandoc/issues/1965
It should be possible to cobble together a Lua filter to create a list of tables and insert it into a template variable or the document itself -- has anyone done this?  I believe that the pandoc-crossref filter gives you the ability to add a list of tables:
http://lierdakil.github.io/pandoc-crossref/


> 3. If converting from Markdown to PDF, I can use
>    `-V links-as-notes` to have hyperlinks printed as footnotes. Is there
>    a better way?

A better way to do what?  And what's wrong with this way?

>    And is it possible to show hyperlinks as footnotes if converting from
>    Markdown to HTML?


You could write a Lua filter that does this.  Indeed, it might be a nice idea for us to create a general linksToNotes transform in pandoc, and a command-line option that offers links-as-notes in every format.  but for now, a filter is the way to go.  It would be simple.  You just need to match on Link elements and turn them into Note elements.



-- 
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/5BB122BF-5CC4-4DA0-836D-09FB4BE2A3C7%40gmail.com.


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

* Re: Command line options vs. Options in YAML metadata block
       [not found]     ` <5BB122BF-5CC4-4DA0-836D-09FB4BE2A3C7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2022-08-23 11:40       ` name name
  0 siblings, 0 replies; 3+ messages in thread
From: name name @ 2022-08-23 11:40 UTC (permalink / raw)
  To: pandoc-discuss


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

Thanks, fiddlosopher.

On Monday, August 22, 2022 at 7:40:02 PM UTC+3 fiddlosopher wrote:

>
>
> > On Aug 21, 2022, at 5:08 AM, name name <ivan20...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> > 
> > I try to understand how the command line options and the options in the 
> YAML metadata blocks work.
> > 
> > This is a test file:
> > 
> > ~~~
> > ---
> > title: title
> > toc: true
> > number-sections: true
> > lot: true
> > ...
> > 
> > # section one
> > 
> > body text
> > 
> > [this is a hyperlink](https://google.com/)
> > 
> > # section two
> > 
> > body text
> > 
> > # section three
> > 
> > Table: This is a table
> > 
> > default right right
> > ------- ------ ------
> > row 1 1,000,000 10
> > rr oo ww 2 10,000 1,000,000
> > 
> > Table: This is another table
> > 
> > default right right
> > ------- ------ ------
> > row 1 1,000,000 10
> > rr oo ww 2 10,000 1,000,000
> > ~~~
> > 
> > My questions:
> > 
> > 1. Why `toc`, `number-sections`, and `lot` in the YAML metadata block
> > doesn't work if converting from Markdown to HTML? (Though they work
> > if converting from Markdown to PDF.)
>
> All metadata variables automatically populate template variables when 
> templates are being filled in. In some formats, `toc` is used as a template 
> variable to trigger inclusion of a certain command (`\tableofcontents` in 
> the case of LaTeX). But in other formats, the TOC can't be produced by a 
> command; we need to build it in the writer. So, it's just an accident that 
> it works in some formats. Don't rely on this.
>
> > 
> > 2. To have the table of contents if converting from Markdown to HTML,
> > I can use a command line option `--table-of-contents`.
> > Is there a similar command line option to have list of tables if
> > converting from Markdown to HTML?
>
> Not currently, but it would be a nice feature to add.
> https://github.com/jgm/pandoc/issues/1965
> It should be possible to cobble together a Lua filter to create a list of 
> tables and insert it into a template variable or the document itself -- has 
> anyone done this? I believe that the pandoc-crossref filter gives you the 
> ability to add a list of tables:
> http://lierdakil.github.io/pandoc-crossref/
>
>
> > 3. If converting from Markdown to PDF, I can use
> > `-V links-as-notes` to have hyperlinks printed as footnotes. Is there
> > a better way?
>
> A better way to do what? And what's wrong with this way?
>
> > And is it possible to show hyperlinks as footnotes if converting from
> > Markdown to HTML?
>
>
> You could write a Lua filter that does this. Indeed, it might be a nice 
> idea for us to create a general linksToNotes transform in pandoc, and a 
> command-line option that offers links-as-notes in every format. but for 
> now, a filter is the way to go. It would be simple. You just need to match 
> on Link elements and turn them into Note elements.
>
>
>
>

-- 
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/c4ff7f18-b3f2-43e7-b6b8-7696becbd1adn%40googlegroups.com.

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

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

end of thread, other threads:[~2022-08-23 11:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-21 12:08 Command line options vs. Options in YAML metadata block name name
     [not found] ` <c755bc3e-1a76-4673-ba61-fa7e3cf9a6can-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2022-08-22 16:39   ` John MacFarlane
     [not found]     ` <5BB122BF-5CC4-4DA0-836D-09FB4BE2A3C7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2022-08-23 11:40       ` name name

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