提供使用pygments突出显示语法的功能。
django-pygments-renderer的Python项目详细描述
提供使用Pygments突出显示语法的功能。
安装
django pygments渲染器需要python 3.6或更高版本和django 2.0或更高版本。
$ python3 -m pip install django-pygments-renderer
用法
INSTALLED_APPS+=['pygments_renderer',]
{% load i18n %} {% load pygmentize %} <html><head><title>{{ snippet.title}} - djangosnippets</title><style>{%pygments_css%}</style><!-- other header tags --></head><body><divclass="container"><h2class="title">{{ snippet.title }} by {{ snippet.created_by.username }}</h2><divclass="sourcecode"> {{ snippet.code|pygmentize:"python3" }} </div><div> {{ snippet.description }} </div></div></body></html>
类似项目
开发
- 绒布:tox -e flake8或flake8
- 测试:tox -e py37或DJANGO_SETTINGS_MODULE=test_settings python -m django test
许可证
这个软件是在麻省理工学院的许可下授权的(见LICENSE)。