使用什么应用程序创建这些代码预览图像?

问题描述

我在Instagram和Medium.com上看到了很多具有macOS窗口样式的代码预览图像。使用什么应用程序创建这些样式的图像: Code preview with macOS window style example

解决方法

这是通过基于from rich import print from astroquery.simbad import Simbad def ask_for(prompt,error_msg=None,_type=None): """ While the desired prompt is not given,it repeats the prompt. """ while True: inp = input(prompt).strip() if not inp: if error_msg: print(error_msg) continue if _type: try: inp = _type(inp) except ValueError: if error_msg: print(error_msg) continue return inp def simbad_query(): not_target = True while not_target: try: print( '\nTo find the [blue]RA and Dec[/blue] of your target,please put it in here.') print("If your target can't be found,it will automatically redirect you to the website to put it in again.") target = ask_for('\nTarget name: ') query = Simbad.query_object(f'{target}') query.pprint() except AttributeError: print( '\nThe target you gave was [red]not found[/red]. Please try again.') print( '\nTo find the [blue]RA and Dec[/blue] of your target,it will automatically redirect you to the website to put it in again.") target = ask_for('\nTarget name: ') query = Simbad.query_object(f'{target}') query.pprint() 命令的 quicklook 系统扩展来完成的。在Finder中选择代码文件,然后按空格键激活 quicklook ,然后使用屏幕截图捕获窗口。 helloworld.c code highlighting example

允许样式自定义的quicklook系统扩展的一个示例是https://github.com/sbarex/SourceCodeSyntaxHighlight