Skip to content

Add “Export to RTF” option for code editor with syntax highlighting #25534

@chdebernardi

Description

@chdebernardi

Description

Currently, Spyder does not provide a built-in way to export code from the editor to an RTF (Rich Text Format) file while preserving syntax highlighting.
This feature would be very useful for users who need to include Python code in:

  • Word / LibreOffice documents
  • Reports, theses, or teaching materials
  • Documents that require RTF instead of HTML or PDF

At the moment, users must rely on workarounds (copy–paste, external tools like Pygments), which is not always reliable or convenient, I use NPP export plugin on Notepad++.

Proposed solution

Add an “Export → RTF” option in the editor (or context menu) that:

  • Exports the selected code or the entire file
  • Preserves syntax highlighting and indentation
  • Uses the current Spyder theme (or a default one)
  • Generates a .rtf file compatible with Word / LibreOffice

Why this matters

Improves workflow for academic and professional users
Reduces reliance on external tools
Aligns Spyder with other editors that offer rich-text or formatted exports

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions