Skip to content
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

Use extra Jinja-Environment? #42

Open
janbrohl opened this issue Jan 15, 2020 · 6 comments
Open

Use extra Jinja-Environment? #42

janbrohl opened this issue Jan 15, 2020 · 6 comments
Labels

Comments

@janbrohl
Copy link
Collaborator

Should we really use the Sphinx builder's Jinja Environment? At least escaping propably depends on the builder. Do we want that?

@dhellmann
Copy link
Member

I'm not sure what you mean about escaping, can you elaborate?

@janbrohl
Copy link
Collaborator Author

Jinja supports auto-escaping potentially problematic strings ( https://jinja.palletsprojects.com/en/2.10.x/api/#autoescaping ) which may or may not be enabled depending on the environment (builder).
Using an independent environment would provide seperately defined template paths, defined auto-escape setting, more similarity to direct command line usage.

@dhellmann
Copy link
Member

If each builder configures the environment with different escaping rules, don't we want those builder-specific settings? Or maybe not, since they are language-specific (HTML vs. RST)?

@janbrohl
Copy link
Collaborator Author

We would want ReST escaping as that is what we parse with sphinx.util.nodes.nested_parse_with_titles. Generating HTML is not our business, sphinx does that.

@dhellmann
Copy link
Member

I could see escaping being useful, but I could also see it being useful to have embedded RST in the data that a user wants rendered. So it's fine if we make escaping the default, but there needs to be a way to turn it off.

@janbrohl
Copy link
Collaborator Author

As stated in #60 how to escape depends on context so not escaping by default but having escape functions or filters seems more doable.
So we just want autoescaping off, I think.

@janbrohl janbrohl mentioned this issue Jan 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants