Skip to content
New issue

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

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

Already on GitHub? # to your account

add blockquote support #50

Merged
merged 3 commits into from
Jun 24, 2017
Merged

add blockquote support #50

merged 3 commits into from
Jun 24, 2017

Conversation

bartbutler
Copy link
Contributor

Pretty self-explanatory. We use html2text to generate plaintext versions of HTML emails, among other things. Block quote tags were previously ignored, but they should not be.

@soundasleep
Copy link
Owner

soundasleep commented Jun 23, 2017

I love the idea of this change! Thank you! When implementing html2text, I'd like the text output to resemble very similarly to what a web browser would present. So, for example with your source, Firefox renders this like:

html2text blockquote

So, for the text version, I would want something like this (note the extra newlines):

Hello

> Nest some block quotes with preformated text
>
>> Here is the code
>>
>> #include <stdlib.h>
>> #include <stdio.h>
>>
>> int main(){
>>	return 0;
>> };
>>
>> Put some tags at the end
>
> Some text and tags here
>
>> And some more tags in another quote

Some ending text just to make sure

I appreciate this might be a bit more complicated to implement, but I would love to see this. Would you be keen to update your code?

(I also left two minor style comments, just so the style matches within the file.)

You might also want to add a test that mixes <h1> elements, <hr> elements, and especially <p> elements etc - the newlines can be a bit finicky sometimes.

Thank you for this PR!

@bartbutler
Copy link
Contributor Author

Extra newlines shouldn't be too tricky. I'll see what I can do. I'll mix in some of the problematic tags too.

@bartbutler
Copy link
Contributor Author

I don't see any style comments...did you forget to submit your review?

@bartbutler
Copy link
Contributor Author

Another thing is that blockquotes aren't used much in web development, but they are used a lot in HTML email. The more relevant newline behavior might be how it is rendered in Thunderbird rather than FF. In any case, I'll look into it.

@bartbutler
Copy link
Contributor Author

Should be done. Guessed at the style stuff as I didn't see any comments for that. Also, the newlines test I put in in a previous PR wasn't being run, so I fixed that and some related issues as well. Let me know if you want any more changes.

@soundasleep
Copy link
Owner

Sweet, this looks great. Thank you for the PR!

@soundasleep soundasleep merged commit ff58753 into soundasleep:master Jun 24, 2017
@bartbutler
Copy link
Contributor Author

You're welcome!

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

Successfully merging this pull request may close these issues.

2 participants