Giter Site home page Giter Site logo

Custom parser options about marked-react HOT 5 OPEN

sibiraj-s avatar sibiraj-s commented on June 15, 2024
Custom parser options

from marked-react.

Comments (5)

sibiraj-s avatar sibiraj-s commented on June 15, 2024 1

Currently I am working something with <Marked instance={customMarkedInstance} /> and planning to support extensions as well but it can be only done after markedjs/marked#2805, because the current @types/marked is messed up and doesn't exactly reflect marked library giving several errors with typescript.

Boy its not easy. I'll try but even if I support extensions, It might help your case, but it might not be possible to provide 100% support for extensions, as the renderer part in marked returns html and not react elements so it might be omitted

from marked-react.

tanmayaBiswalOdiware avatar tanmayaBiswalOdiware commented on June 15, 2024

What are you trying to parse here besides the usual?

from marked-react.

ReyMagos avatar ReyMagos commented on June 15, 2024

I have keyword that indicates following block should be wrapped into my component. And I need to handle this keyword in parser to properly set token type.

from marked-react.

sibiraj-s avatar sibiraj-s commented on June 15, 2024

Hi, Currently the parser accepts only tokens that are parsed by marked. See

const tokens = props.isInline
? Lexer.lexInline(markdownString, lexerOptions)
: Lexer.lex(markdownString, lexerOptions);

I'am open to suggestions to solve this, if marked allows to extend and parse into custom tokens, we could allow here as well. Why not.

from marked-react.

tanmayaBiswalOdiware avatar tanmayaBiswalOdiware commented on June 15, 2024

I wondered for a while what you might be able to do here. Reading the marked documentation, you can see - we need to define a custom object as shown in the example. Maybe you can expose the lexar variable to the client in order to return a custom token. I am not completely sure how we go about doing that. Perhaps you can test it :)

from marked-react.

Related Issues (12)

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.