如何解决使用什么应用程序创建这些代码预览图像?
我在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 ,然后使用屏幕截图捕获窗口。
允许样式自定义的quicklook系统扩展的一个示例是https://github.com/sbarex/SourceCodeSyntaxHighlight
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。