Saving a procedure window as an .rtf document or Notebook?

I would like to get recommendations on how to save a procedure as a text document ( or exportable .rtf Notebook) that retains the default Igor syntax coloring. My reasons for this somewhat odd request are (1) sharing code ideas with non-Igor users, using syntax coloring to aid in interpretation, and (2) for my own editing purposes, in simplifying the transfer of code fragments from one pxp to another, without having to open simultaneous large pxp's,  going back and forth between them, or incurring a barrage of compilation errors (particularly related to WAVE, NVAR, .. global declarations). Igor Pro 8 (Win 10) seems to have no mechanism to do this. The procedures themselves are usually not sufficiently general for saving as User Procedures.

I expect that some Exchange responses may mention using external editors. If so, are any suitable for the above purpose only, and not as the IP default editor? Saving as a Notebook-compatible rtf would be the desired goal (so as to work almost entirely within Igor).

A kludgy test I tried was to copy a test ipf into a Word rtf document. The syntax coloring was kept (so it might be useful for purpose 1), but inserting the rtf file into a Notebook did not work (because of the vagaries of .rtf file structures). Copy-and-pasting its colored text into a Notebook lost the coloring (like using an ipf source).

In the past I have used this solution on Mac.

Using pyments on the command line you can convert ipf files to rtf with Igor highlighting.

pygmentize -f rtf -O style=igor -O full -o myProcedure.rtf myProcedure.ipf

Nowadays, the highlighters in Atom and on GitHub suit my needs, but in the past I used this to mark up Igor procedures for sharing on the web.

You can select text in a formatted notebook and select Notebook->Syntax Color Selection to syntax color the selection. You can also export notebooks as RTF.

Using RTF for code does not strike me as a particularly good idea, but it's what you asked for.

A lot of code editors can be taught about igor syntax highligthning rules, see https://www.wavemetrics.com/code-snippet/list-editorhighlightning-engin….

For making code public for readers I tend to either use sphinx [1] or latex [2]. Both solutions aim more for quality than ease of use though. I can provide details if anyone is interested.

[1]: https://docs.byte-physics.de/igor-unit-testing-framework/examples.html#…
[2]: https://raw.githubusercontent.com/byte-physics/igor-pro-coding-conventi…

@thomas_braun I'd be interested in your method for highlighting in LaTeX, do you use the minted package or something else?

Thanks, all. Adam's suggestion best meets my needs. I'm not surprised by his skepticism, but "chacun a son gout".