Comments (9)
You'll have to take that up with the markdown authors. This is merely glue.
from flask-markdown.
This has nothing to do with Markdown itself. Markdown is designed to operate on escaped content. I would think it would be fine to force escaping whenever it is called, but the more "correct" way would be to autoescape it normally.
It is possible to obtain the autoescaping configuration from the template context and honor it. The Jinja docs use this exact problem as an example, search for "current autoescape": http://jinja.pocoo.org/docs/api/#low-level-api
I am working on a patch. Please re-open the issue in the meantime.
from flask-markdown.
Are you saying that if you explicitly escape then markdown works correctly? I read your initial ticket to say that nothing worked if you explicitly escaped. I found that a surprising notion hence the closing of this ticket and the suggestion you talk with the markdown authors. Please clarify what the issue is with a failing test or a clearer reproduction case.
from flask-markdown.
I've reopened this for a fairly well thought out patch, some docs and tests. I expect the code to allow full control of the auto-escaping.
from flask-markdown.
Sorry for being unclear, then. Yes, the Markdown works just fine if I explicitly escape. I'm not sure why you would ever not want to escape before converting the Markdown, but maybe my imagination is failing me.
from flask-markdown.
Well, this is the first time I've heard of this issue so it's possible some users rely on the current behavior. Additionally, I don't like placing limitations on what one can do with code. Since both scenarios can be supported, I would prefer to manage the auto-escape with configuration and default to the existing behavior.
from flask-markdown.
Agreed. :) Working on it.
from flask-markdown.
I'm probably going to sign off for the night now, but this is what it's ending up looking like. Obviously not finished, and I'd like your ideas on a better way to preserve the Markdown instance than sticking it into the app config. I'm not super-familiar with Flask's internals, but surely there is a better place for it.
Moving the function out of the Markdown class seems to be necessary because Jinja passes the eval context in a very hacky way. The decorator ends up passing the eval_ctx
as the first parameter. Obviously, this conflicted with the method because self
kept overriding it.
from flask-markdown.
This is now being discussed in the PR #5, I am closing.
from flask-markdown.
Related Issues (13)
- easy_install HOT 2
- ~~strike~~ option HOT 1
- Add in auto_reset HOT 3
- This thing is awesome. Thanks!
- How to generate toc in Jinja when extension is set ? HOT 1
- support for the application factory pattern HOT 3
- Doesn't support bold ? HOT 2
- Jinja url_for
- Bug rendering nested lists
- ImportError: cannot import name 'Markup' from 'flask' HOT 4
- ImportError: No module named markdown HOT 1
- flask-markdown0.3 using uwsgi/virtualenv/nginx HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flask-markdown.