Giter Site home page Giter Site logo

Comments (5)

jgm avatar jgm commented on September 28, 2024

You want to disable parsing of block-level HTML entirely? You can simply define your own variant of defaultBlockSpecs that leaves out the block HTML parser.

myDefaultBlockSpecs :: (Monad m, IsBlock il bl) => [BlockSpec m il bl]
myDefaultBlockSpecs =
    [ indentedCodeSpec
    , fencedCodeSpec
    , blockQuoteSpec
    , atxHeadingSpec
    , setextHeadingSpec
    , thematicBreakSpec
    , listItemSpec (bulletListMarker <|> orderedListMarker)
    -- , rawHtmlSpec  -- <- leave this out!
    , attributeSpec
    ]

If you want to parse raw HTML blocks, but just not ones that begin with <a34s...> or whatever, then you can modify the block HTML parser.

from commonmark-hs.

srid avatar srid commented on September 28, 2024

Thanks.

If you want to parse raw HTML blocks, but just not ones that begin with <a34s...> or whatever, then you can modify the block HTML parser.

I suppose this is what I will end up doing. Though it would be nice if there is someway to override the angle-bracket link content parsing without modifying the library.

from commonmark-hs.

jgm avatar jgm commented on September 28, 2024

You don't actually have to modify the library. You can create your own myBlockHtmlSpec that just modifies the standard one a bit (this would only be a few lines of code, I think, because you can use the standard one in the definition), and use this instead of the default one n a custom myDefaultBlockSpecs as above.

from commonmark-hs.

srid avatar srid commented on September 28, 2024

because you can use the standard one in the definition

Hmm, you mean I can reuse the rawHtmlSpec function? I don't see how though, because it doesn't take any arguments. Actually I'm at the point of forking this function and disabling that ty == 7 case altogether ...

EDIT: I guess I could override blockStart - but I'd still have to re-implement that part, and that startCond func is not exported.

from commonmark-hs.

jgm avatar jgm commented on September 28, 2024

See my comment on your PR.

from commonmark-hs.

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.