Skip to content

[rich-text-plain-text-renderer] Allow custom render nodes to be provided like Rich Text Html Renderer #660

@localpcguy

Description

@localpcguy

Feature Request: Allow custom render nodes to be provided like Rich Text Html Renderer. Use the same syntax as the RichTextHtmlRenderer does.

By allowing custom render nodes to be passed, users can handle things like embedded entries (see #161) as well as allowing for custom output for items such as links where both the text and uri would likely be desired.

An example:

A link could look something like this:

const customTextRenderNode = {
  renderNode: {
    [INLINES.HYPERLINK]: (node, next) => `${next(node.content)}: ${node.data.uri}\n`,
  },
};

And be called like this:

const renderedText = documentToPlainTextString(richTextDocument, null, customTextRenderNode);

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions