GithubHelp home page GithubHelp logo

remove all the join('') about redraft HOT 3 CLOSED

lokiuz avatar lokiuz commented on July 17, 2024
remove all the join('')

from redraft.

Comments (3)

lokiuz avatar lokiuz commented on July 17, 2024

Main focus of redraft always was rendering to directly to React components. Handling strings in nested arrays may be bit awkward if you need a pure string output.

With this in mind I don't think there's real reason to change the default output. What's possible is to add a flag to merge the output to a single string, something like:

redraft(raw, renderers, { mergeOutput: true })

This would have to assume that all your rendering functions return strings.

from redraft.

lokiuz avatar lokiuz commented on July 17, 2024

Hey, I went with:

redraft(raw, renderers, { joinOutput: true })

It joins the output and the children of all the inline and entity renderers, you still have to join the block level children seeing as a single child there can be for example a separate <li> tag. Also mind you have to make sure all the renderers return strings it you plan to use this option.

from redraft.

lokiuz avatar lokiuz commented on July 17, 2024

Rendering to string should be much simpler now, while you need to join the block level output it wont receive any nested arrays so a single join('') should be enough. Currently I don't see much more could be done with this, so I'm closing this.

from redraft.

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.