Giter Site home page Giter Site logo

Comments (5)

Orc avatar Orc commented on September 26, 2024

Try this patch:

diff --git a/markdown.c b/markdown.c
index dc7deea..ad0ea62 100644
--- a/markdown.c
+++ b/markdown.c
@@ -938,7 +938,7 @@ compile_document(Line *ptr, MMIOT *f)
     int eaten;

     while ( ptr ) {
-       if ( !(f->flags & DENY_HTML) && (tag = isopentag(ptr)) ) {
+       if ( (tag = isopentag(ptr)) && ((tag == &comment) || !(f->flags & DENY_H
            /* If we encounter a html/style block, compile and save all
             * of the cached source BEFORE processing the html/style.
             */

I may put it in, but right now I'm worried about security implications (are there flaws in my html block parser that would let someone sneak malign content into the code) and policy implications (some of the sites that use discount run it with -fnohtml, and may be annoyed if any raw html gets through, even if it's just a comment.)

from discount.

eligrey avatar eligrey commented on September 26, 2024

I'll pentest it tomorrow, as I have to sleep right now. If it does turn out to have any security vulnerabilities, you can just strip the comments from output.

from discount.

Orc avatar Orc commented on September 26, 2024

If I have to wrapper discount to strip comments, I would be better off not specialcasing html comments in the first place.

I'm going to close this issue and query the userbase about whether breaking -fnohtml is a good exchange for always having html comments.

from discount.

Orc avatar Orc commented on September 26, 2024

Upon further consideration there's already a way to pass comments in regular text,
thanks to the raw: pseudo-protocol.

The snippet

text and begin a comment end

generates

p>text and

without having to wait for any future enhancements to the code.

from discount.

Orc avatar Orc commented on September 26, 2024

Oh, and it works right now, obviously, if discount is in an allow-html mode.

The example was supposed to be

[begin]: raw:<!--
[end]: raw:-->

text and [begin] a comment [end]

from discount.

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.