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

Convert HTML to Text #566

Open
TonyValenti opened this issue Aug 15, 2024 · 1 comment
Open

Convert HTML to Text #566

TonyValenti opened this issue Aug 15, 2024 · 1 comment
Assignees

Comments

@TonyValenti
Copy link

Here is what to include in your request to make sure we implement a solution as quickly as possible.

1. Description

It would be really nice if there were a method I could use to convert HTML to text.
This is not the same as Node.InnerText or HtmlEntity.DeEntitize

The goal is that HTML would be converted to text with line breaks that likely represents about what a user would see on the screen.

I propose using the following rules:

  1. <br> inserts a new line.
  2. Content after a </p> inserts two new lines.
  3. URLs generate text like: ``` Text [Link]``

Can you add something like this?

@JonathanMagnan JonathanMagnan self-assigned this Aug 16, 2024
@JonathanMagnan
Copy link
Member

Hello @TonyValenti ,

I don't know if we will add it, but we can certainly discuss it and see if it is worth it. In the worst case, it will become an extension method that you add to your project.

So here are a few questions. How would you treat:

  • Table?
  • List?
  • Image and Alt Text?

I feel that perhaps we will end up using an HTML to Markdown converter

Best Regards,

Jon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants