Giter Site home page Giter Site logo

Comments (9)

dcolish avatar dcolish commented on August 21, 2024

You'll have to take that up with the markdown authors. This is merely glue.

from flask-markdown.

thieman avatar thieman commented on August 21, 2024

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.

dcolish avatar dcolish commented on August 21, 2024

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.

dcolish avatar dcolish commented on August 21, 2024

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.

thieman avatar thieman commented on August 21, 2024

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.

dcolish avatar dcolish commented on August 21, 2024

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.

thieman avatar thieman commented on August 21, 2024

Agreed. :) Working on it.

from flask-markdown.

thieman avatar thieman commented on August 21, 2024

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.

thieman@5a7a70d

from flask-markdown.

dcolish avatar dcolish commented on August 21, 2024

This is now being discussed in the PR #5, I am closing.

from flask-markdown.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.