-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom/New filters #15
Comments
https://stackoverflow.com/questions/10632232/adding-a-custom-filter-to-jinja2-under-pyramid suggests
This approach seems to be quite valid but where should this be placed so that sphinx know about it... |
Not really, but you can hack it in: from functools import wraps
import sphinx.ext.autosummary.generate as gen
import sphinxcontrib.jinja
from jinja2 import Environment
class AutodocEnv(Environment):
@wraps(Environment.__init__)
def __init__(self, *args, **kw):
super().__init__(*args, **kw)
from sphinx.util import rst
self.filters['escape'] = rst.escape
self.filters['e'] = rst.escape
self.filters['underline'] = gen._underline
sphinxcontrib.jinja.Environment = AutodocEnv |
Wooh, awesome reply |
@vancheese I'd be happy to include in the main repo and release a new version. Please submit a PR! :) |
Is it possible to add custom/new filters? If so, where/how would you define them in conf.py
The text was updated successfully, but these errors were encountered: