Skip to content

fix: enable JavaScript for code block syntax highlighting in PDF export (fixes #2984)#3772

Open
KJyang-0114 wants to merge 1 commit intoBoostIO:masterfrom
KJyang-0114:fix/issue-2984-pdf-code-block
Open

fix: enable JavaScript for code block syntax highlighting in PDF export (fixes #2984)#3772
KJyang-0114 wants to merge 1 commit intoBoostIO:masterfrom
KJyang-0114:fix/issue-2984-pdf-code-block

Conversation

@KJyang-0114
Copy link

Summary

This PR fixes the PDF export issue where code blocks were not displaying with syntax highlighting.

Problem

The PDF export feature was not rendering code blocks with syntax highlighting because JavaScript was disabled in the print window (line 8 in formatPDF.js: javascript: false). Since the code block highlighting relies on CodeMirror which runs in the browser, disabling JavaScript prevented it from executing.

Solution

Enable JavaScript in the PDF export window by changing:
javascript: false to javascript: true

This allows CodeMirror syntax highlighting to run during PDF generation.

Testing

  • Export a markdown note with code blocks to PDF
  • Verify that syntax highlighting is visible in the exported PDF

Related Issue

The PDF export was failing to display code blocks with syntax highlighting because JavaScript was disabled in the print window. This fixes issue BoostIO#2984.
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

Successfully merging this pull request may close these issues.

Export as PDF code block display bug

1 participant