Reputation: 17040
I searched around and doesn't seem to have any good solutions.
The closest one: django-pygments doesn't support template context/variable passing as language option.
I want to know if anyone one know of a good solution that supports snippet type passed as template context?
Thanks.
Upvotes: 0
Views: 249
Reputation: 174624
Template:
{% content|pygmentize:lang %}
View:
def show(request):
ctx = dict()
ctx['content'] = 'alert("hello");'
ctx['lang'] = 'javascript'
return render(request,'template.html',ctx)
Upvotes: 1