Docfx: Alerts and other glyphicons and styling not rendered propertly when a PDF is generated

Created on 7 Jul 2018  Â·  9Comments  Â·  Source: dotnet/docfx

DocFX Version Used: 2.36.2

Template used: pdf.default

Steps to Reproduce:

  1. Specify a markdown document which uses an "alert" like:
> [!NOTE]
> The word
  1. Using default docfx.json settings for generating a pdf, build the docfx, which outputs an intermediate html file and a PDF file.

Expected Behavior:

The intermediate html file generated for PDF should render the Note like it does in the website, e.g.:
image

Actual Behavior:

The PDF rendered the note like:
image

Notes
I was able to get this scenario functional by customizing a template and loading the docfx.css into the pdf template.

Area-Pdf enhancement

Most helpful comment

My apologies for the delay. I output the styles from the default template using docfx.exe template export default. From the output, I renamed docfx.css to default.css and copied this and docfx.js, docfx.vendor.css and docfx.vendor.js to another folder, like:

docFxTemplates\pdf\styles
…
    default.css
    docfx.js
    docfx.vendor.css
    docfx.vendor.js

Then in the docfx.json I updated the template section, like:

"template": [
    "pdf.default",
    "docFxTemplates/pdf"
]

All 9 comments

@partychen, can you advise on how to customize the CSS for PDF template? Thanks!

@herohua , I was able to customize the PDF template to include the docfx.css from the default template. As a user, however, I was expecting this functionality to exist without customization (since I didn't customize the default web template, why would I have to customize the PDF template?). If the default web template includes support for things like glyphicons, couldn't the default PDF template include this support as well?

@MrBenMyster Could you please let me know which part you have customized? Thanks.

My apologies for the delay. I output the styles from the default template using docfx.exe template export default. From the output, I renamed docfx.css to default.css and copied this and docfx.js, docfx.vendor.css and docfx.vendor.js to another folder, like:

docFxTemplates\pdf\styles
…
    default.css
    docfx.js
    docfx.vendor.css
    docfx.vendor.js

Then in the docfx.json I updated the template section, like:

"template": [
    "pdf.default",
    "docFxTemplates/pdf"
]

I had to add the fonts folder to my custom template too.

Additionally the markdown emojis are not working in pdf.

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

@MrBenMyster Thank you for the information. I agree it is ideal to work without customization. However, I am not sure whether it will break anything after this replacement. I need more investigation on this.

fixed in 2.56.3

Was this page helpful?
0 / 5 - 0 ratings