Docfx: The TOC for PDF does not allow as many levels as the default website TOC

Created on 7 Jul 2018  路  6Comments  路  Source: dotnet/docfx

DocFX Version Used: 2.36.2

Template used: pdf.default

Steps to Reproduce:

  1. Specify a toc.yml which loads a markdown file that has ATX headers at level three or greater, for example:
    The toc.yml:
  - name: Articles
    href: ../Articles/toc.md
    topicHref: ../Articles/toc.md

The toc.md:

# Operations
## Authoring
### [How to Author a Resource](Author_a_resource.md)
  1. Using default docfx.json settings for generating a pdf, build the docfx, which outputs a PDF file.

Expected Behavior:

  1. The PDF Table of Contents should allow up to H6 using the ATX specification (https://daringfireball.net/projects/markdown/syntax)

Actual Behavior:
The How to Author a Resource markdown document was not displayed in the PDF TOC.

Notes
I was able to get this scenario functional by modifying the toc.html.tmpl file and loading a custom template based on pdf.default.

Area-Pdf enhancement help-wanted

All 6 comments

I guess we don't have such limitations on TOC level. @partychen , can you confirm?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

How was toc.html.tmpl file modified to work-around this issue?

By inserting the following:

<a class="normal slidedown" href="javascript:void(0)">{{ name }}</a> {{/ href }} {{# items.0 }}
<ul class="tocLevel{{level}}">
      {{/ items.0 }} {{#items}}
<li>
      {{# href }}
      <a class="normal" href="{{ href }}">{{ name }}</a> {{/ href }} {{^ href }}

See original on left, modified toc.html.tmpl on right:
snip_20190403140903

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in a week if no further activity occurs.

Was this page helpful?
0 / 5 - 0 ratings