Is there a way in VS Code to export code with syntax highlighting?

Viewed 604

I have code in VS Code that I would like to send to someone. For their convenience, I would like them to be able to open it up in a normal text editor or even browser and view syntax-highlighted code with the indentation preserved. They will be reading the code but not modifying it, running it, or setting up any sort of environment. Any common rich text format is acceptable (rtf, odt, docx, etc).

Copying and pasting into LibreOffice Write gives me the highlighting but does not preserve the spacing (I think because it's pasting as HTML). Pasting into LibreOffice Write as unformatted text preserves the spacing but clears the highlighting.

The ideal solution would be an extension that adds the menu option to "Export highlighted code" or something like that, but I'm thankful for whatever works.

0 Answers
Related