Fix for preformatted code blocks in PDFs

I didn't want to hide this particular bug fix behind a "National ____ Day" title, so the title here is accurate: we released a bug fix for a longstanding bug in our PDF generator, and we're pretty excited about it!

The issue we resolved was for cases of preformatted blocks that contained code examples (such as scripts, HTML, etc.). While these preformatted blocks displayed perfectly fine in the live knowledge base, they wouldn't format properly in Individual Article PDFs, Standard PDF exports, or Custom PDF exports. Most often, the PDFs would display an empty preformatted line instead of the code.

We've been working on some upgrade to our code base, and as part of those changes we were able to refactor some aspects of our PDF generation. Our initial testing shows that these preformatted code blocks are now properly displaying in PDFs generated from 17 April onward! 🎉

Since the change impacts the PDFs only, you won't see it unless the PDFs have been regenerated since yesterday:

  • For individual articles, you'd need to re-save the article to see the PDF update. If you'd like all your individual article PDFs regenerated so they can pull in these changes, please contact us .
  • For the Standard PDF export and any Custom PDF exports, you'd need to hit the regenerate button and wait for the PDFs to regenerate to see those changes.

For those of you who've reported this issue, thank you so much for your patience, as it's taken us quite a bit of time to find a good solution that didn't negatively impact other aspects of PDF generation.

Please go regenerate some PDFs and let us know if you're still noticing any issues with your preformatted code blocks!

Once more, with examples

If none of that made any sense to you, here's a quick example:

If you view Add category icons to your homepage category panels, step #4 has a script available in a preformatted block for you to copy and paste.

With the old PDF generation process, anything within HTML tags wouldn't generate properly, so that script just showed up as an empty line in our PDFs:

See that Step #4 doesn't have the actual script in the PDF?

With this week's fix, that block of code now properly displays after we resave to regenerate the PDF:

Now you see it!