Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add number_section function in yaml options? #56

Open
JiaxiangBU opened this issue Oct 26, 2018 · 7 comments
Open

add number_section function in yaml options? #56

JiaxiangBU opened this issue Oct 26, 2018 · 7 comments

Comments

@JiaxiangBU
Copy link

JiaxiangBU commented Oct 26, 2018

I find there are toc and toc_depth options in yaml. Maybe number_section function will make the toc better.

    radix::radix_article:
        toc: true
        toc_depth: 2
        number_section: yes
@jjallaire
Copy link
Member

The problem is that pandoc number_sections wants to use H1 as section headings within the document whereas radix/distill uses H2 section headings. So even if you add number_sections (which you could actually do via pandoc_args: ["--number-sections"] ) you get unsatisfactory output.

@larmarange
Copy link

It seems that section numbering could be customized with pandoc-crossref, cf. http://lierdakil.github.io/pandoc-crossref/#section-numbering

@larmarange
Copy link

Integrating crossref within Radix would also allow to customize Figure and Table labels (cf. http://lierdakil.github.io/pandoc-crossref/#settings-file)

@jjallaire
Copy link
Member

The issue w/ relying on pandoc-crossref is that users need to install another Haskell binary (which will I think be too big a hurdle to surmount for most). It would be much better to find a solution based on a a Lua filter.

@larmarange
Copy link

That issue of adding an additional parameter to pandoc has been raised on pandoc's GitHub: jgm/pandoc#5071

However, as long as a new option is not added to Pandoc, another possibility would be to rely on a custom filter, directly provided by Radix.

@ssp3nc3r
Copy link

The problem is that pandoc number_sections wants to use H1 as section headings within the document whereas radix/distill uses H2 section headings. So even if you add number_sections (which you could actually do via pandoc_args: ["--number-sections"] ) you get unsatisfactory output.

Adding pandoc_args: ["--number-sections"] actually works fine, at least if using distill::distill_article as a base_format for bookdown::html_document2:, like so:

output:
  bookdown::html_document2:
    base_format: distill::distill_article
    toc: true
    toc_depth: 2
    pandoc_args: ["--number-sections"]

@GitHunter0
Copy link

Adding pandoc_args: ["--number-sections"] actually works fine, at least if using distill::distill_article as a base_format for bookdown::html_document2:, like so:

Nice trick, it is working for me even for native distill articles

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants