mangini / gdocs2md

Convert a Google Drive Document to the Markdown format, suitable for publishing.
Apache License 2.0
2.66k stars 621 forks source link

Support exporting to new files in Drive, and improved handling of bold and italic formatting. #26

Closed trepidacious closed 9 years ago

trepidacious commented 10 years ago

Hi, Thanks for the converter - just what we needed to get a more useful document format out of Google Drive!

We had some minor problems with the export, where some of our documents had odd italic and bold formatting, which covered leading/trailing whitespace (sometimes even JUST whitespace, e.g. a single "italic" space between words). Since this is invisible in the original documents it's hard to correct.

Commit c72c363 deals with this by shrinking the regions of bold and italic formatting to remove leading/trailing whitespace, which removes useless formatting and also makes the output more compliant with markdown.

I've also included commits to make the converter more flexible, by allowing exporting to new files in your drive, and to use a new mimeType so that e.g. stackedit.io will see the files. This also means that when they are downloaded, they have just an "md" extension, not ".md.txt". Finally, it makes nested italic and bold a little neater by breaking up the asterisks so it's easier to read.

Let me know if you would prefer a pull request for just the italic/bold. I've also got a Drive document with some examples of odd formatting that is fixed by the changes. I don't think the changes should break anything, but I could have missed a possibility.

Thanks, Ben.

trepidacious commented 9 years ago

I didn't realise this pull request was still open - closing since it now covers too much stuff!