Giter Site home page Giter Site logo

Comments (3)

obedm503 avatar obedm503 commented on June 16, 2024

It's difficult to understand what's going on. Can you give a file or repo that reproduces and explains the issue?

from showdown-katex.

AkinOlawale avatar AkinOlawale commented on June 16, 2024

It's difficult to understand what's going on. Can you give a file or repo that reproduces and explains the issue?

Okay. My bad. I'll explain properly.

I'm using showdown library via the browser as

const converter = new showdown.Converter();

Then I call filterXSS(converter.makeHtml(htmlStuff));

The filterXSS() function comes from <script src="https://rawgit.com/leizongmin/js-xss/master/dist/xss.js"></script>

The above steps work without integrating your library

But when I integrate with your library via the extension parameter as:

converter = new showdown.Converter({
                extensions: [
                    showdownKatex({                        
                        throwOnError: true,                        
                        displayMode: false,                        
                        errorColor: '#1500ff',                        
                    })
                ]
            });
            html = converter.makeHtml(string);
            target_div_id.innerHTML = filterXSS(html);

Things break.

From my debug attempt, the filterXSS() strips away the HTML.
When I remove filterXSS(), it works perfectly.

Is there anyway to filter the output without losing the result?

from showdown-katex.

obedm503 avatar obedm503 commented on June 16, 2024

That seems counter-productive. I imagine filterXSS is mean to convert html characters to html entities (<script> -> &#x3C;script&#x3E;) or "make the html safe". It seems like filterXSS is doing exactly what it's supposed to.

Is there anyway to filter the output without losing the result?

That seems like a question for leizongmin/js-xss

from showdown-katex.

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.