Skip to content

Code Highlighting inside blockRenderers  #252

Description

@agjs

Hey guys. I'm trying to use SyntaxHighlighter inside blockRenderers for code-block but naturally, as each block inside blockRenderers expects to return a string (and not a Node, aka, Element), this won't work.

Example:

    blockRenderers: {
      "code-block": block => {
        return (
          <SyntaxHighlighter language='javascript' style={docco}>
            {block.getText()}
          </SyntaxHighlighter>
        );
      }
    }

So I wonder, what is the alternative to this. How can we add code highlighting inside blockRenderers?

Thanks a bunch in advance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions