GithubHelp home page GithubHelp logo

Comments (4)

rexxars avatar rexxars commented on May 23, 2024 4

Yes, you can either pass the skipHtml property, which will simply... skip HTML.
Or, you can use the escapeHtml property, which will render HTML as plain text.

from react-markdown.

IonicaBizau avatar IonicaBizau commented on May 23, 2024 1

@rexxars Thanks for the quick reply. I'm learning React these days and I simply want to render a piece of markdown in my app (which may contain HTML, because it's coming from the user).

Is there an option to disable the HTML rendering in this component currently?

from react-markdown.

rexxars avatar rexxars commented on May 23, 2024

By disallowing HTML, basically. I don't think protecting against XSS should be part of this library - there are better alternatives for that. In the next major version of react-markdown, I actually aim to disable rendering of HTML by default - only enabling it behind an explicit property.

We do try to prevent XSS in markdown however, such as images and links rendered with actual markdown tags. Sorry if that wasn't the answer you were hoping for, but trying to handle sanitation of HTML is just a slippery slope to madness that I'd rather not handle unless I have to.

from react-markdown.

IonicaBizau avatar IonicaBizau commented on May 23, 2024

Thanks! escapeHtml is what I wanted. Next time I'll check the docs more carefully. πŸ“ πŸ‘€

from react-markdown.

Related Issues (20)

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.