0

I'm using VSCodium and I typically keep project notes in .rtf files, where I can use different fonts (such as courier for code snippets) and bold or occasional coloured highlights for emphasis.

I need to have my notes file active alongside my IDE, but rather than a separate app to manage that, it would be nice to use one of the VSCodium tabs. However, opening an .rtf file there displays plain text and all the control codes. Can someone suggest how to have .rtf files rendered properly in VSCode tabs?

Of course I'd also want to edit and add to the files, so I'm hoping it will handle and write proper .rtf files for me too.

Thanks -Ross

RossGK
  • 515
  • 2
  • 7
  • 19
  • It's basically the same as if you wanted to watch video in VSCode: find or write an extension. Looking for "rtf" in the extension search doesn't show anything similar, so you're out of luck (I don't think RTF is popular any more). I particularly use MarkDown for such notes--it's well supported and works fine where it's not. – Álvaro González Aug 16 '22 at 13:45

1 Answers1

1

As you may have already noticed, there is no extension available that provides such features. Just out of curiosity, I have created a RTF extension for VS Code, but it only provides syntax highlighting for .rtf files, because back then, it was all I needed. I was responsible for supporting a RTF component for Delphi, and parse .rtf files was a pain.

To summarize, in order to achieve a RTF WYSIWYG editor in VS Code, you will need to create a new extension based on the Custom Editor API. They provide a sample in their samples repo, which you could use as a learning point.

On the other hand, if a RTF Preview is a first step / enough for you, I remember searching for NPM packages that would to the trick, and found https://www.npmjs.com/package/@iarna/rtf-to-html as promising. But as RTF format is not exactly a pattern, and every editor seems to use its own flavor, you should look if it works for your use case. This flavor issue and the lack of interest of users were the main reasons I didn't add preview on my RTF extension.

Hope this helps

alefragnani
  • 2,478
  • 11
  • 16
  • Thanks for the background. Good to know. WYSIWYG and low-effort writing of styled text (relative to markdown) is my core need, so preview-only probably wouldn't satisfy. That 'flavours' issue sounds daunting. I use Apple Textedit's implementation normally. I wonder what LibreOffice does for RTF? Maybe there's reusable code from that FOSS project. Sounds like the audience is small though. – RossGK Aug 17 '22 at 13:22
  • 1
    I used to work with WPTools component for Delphi, and had to care with MS Word as an integration tooll (import / export). LibreOffice wasn't officially supported so little experience with it. If I remember correctly, the latest RTF spec I had to look were 1.8. I also used to work with RTF for note taking, but today, Markdown is much more supported, specially on browsers. – alefragnani Aug 17 '22 at 23:24