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

Support elements - <b>, <strong>, <i>, <em>, <del> and <code> #36

Closed
wants to merge 2 commits into from

Conversation

r-a-y
Copy link

@r-a-y r-a-y commented May 5, 2016

Hi Jevon,

Nice library! I've been using it in a few projects.

Here's a PR that supports a few other elements:

  • <strong> uses two asterisks.
  • <em> uses one underscore. Could use the asterisk instead, but thought it might be harder to see when <strong> is in use.
  • <del> uses the Github Markdown syntax of two tildes.
  • <code> uses the ` character.

@r-a-y r-a-y changed the title Support elements - <b>, <strong>, <i>, <em> and <del> Support elements - <b>, <strong>, <i>, <em>, <del> and <code> May 5, 2016
@soundasleep
Copy link
Owner

Hello - I like the idea of this change! Can you add some tests that test each of these new elements?

https://github.com/soundasleep/html2text/tree/master/tests

@jaylinski
Copy link
Contributor

jaylinski commented Nov 25, 2016

Isn't this what html-to-markdown does?

https://github.com/thephpleague/html-to-markdown

@soundasleep
Copy link
Owner

I agree with @jaylinski: This project is about converting HTML to a text format (suitable for emails and generic rendering), rather than converting HTML to a Markdown format (suitable for Markdown parsers).

For example, <h1>xxx</h1> is not converted to "# xxx". It's converted only to "xxx", because this is what it would look like if you rendered the HTML and copy/pasted the text.

If you're looking to convert HTML to markdown, you should use one of these other projects instead.

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

Successfully merging this pull request may close these issues.

3 participants