✨ Export code to image for social media / blogs
Problem: It's hard to share code on social media, e.g. on Twitter with its character limit and lack of syntax highlighting. The same is true for some popular blogs, e.g. on medium.com or even newsletters like getrevue.co.
For example, I recently wrote this newsletter issue / blog article and I had to use services like ray.so and GitHub Gists to show properly syntax highlighted code snippets in a nice, legible size.
Solution: Since CodeEdit already aims to support nice syntax highlighting for many languages and font size customizability and probably even more features that help "making code look nice", I suggest to add a "share image" functionality that could basically just take a screenshot of the current editor view and save that into an image file or allow copying the image into the clipboard for easy pasting into the aforementioned contexts (blog / newsletter / social media).
This should be possible for either the entire current file (e.g. via the existing "File > Share" or a new "File > Export" menu) or just the selected lines of code (same menu on right-click).
Alternatives considered: Before thinking about adding such a feature to this app, I actually considered writing my own Mac app that is built for this purpose alone, supporting only Swift files. But I figured it would be more useful added to this app long term.
Note that there are these services which try to fill the same gap, but none of them allows to share a simple non-windowed image focusing on just the code without shadows & padding (I guess because you could just make a screenshot on your computer, but then I have to always get the pixels perfect and that rounding edge of windows on Mac also look ugly) – also some of them just fail at exporting a (Retina) image:
- https://carbon.now.sh
- https://ray.so
- https://codeimg.io
Additional context A common use case would be that a developer creates a project with lots of small "snippet" files for an article or newsletter, or just a single file for a social media post. In the best case (could be added in later versions), there would be feature to select a specific theme or style where preferred background color and other options are set for the screenshots. Also some extra image-export specific funtionality such as adding a shadow, padding, window style, showing/unshowing line numbers, re-formatting code to a smaller line width etc could be added over time.
Great suggestion! I never considered this being part of the editor itself. I think it makes a lot of sense. We could have a share menu where after a selection is made when clicked gives the user the option to either copy it as plain text, copy it as rich text with syntax highlighting, or create a configurable image.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This is not stale, still valid feature request.