Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
localpcguy opened this issue Aug 23, 2024 · 2 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@localpcguy
Copy link
Contributor

localpcguy commented Aug 23, 2024

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);
@localpcguy localpcguy changed the title [rich-text-plain-text-renderer] Allow custom render nodes to be passed like Rich Text Html Renderer [rich-text-plain-text-renderer] Allow custom render nodes to be provided like Rich Text Html Renderer Aug 23, 2024
@z0al
Copy link
Member

z0al commented Aug 30, 2024

Hey @localpcguy , that sounds like a good idea. Is that something you are willing to submit a PR for?

@z0al z0al added enhancement New feature or request good first issue Good for newcomers labels Aug 30, 2024
@localpcguy
Copy link
Contributor Author

Sure, I can take a stab at it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants