larstvei / ox-gfm

Github Flavored Markdown Back-End for Org Export Engine
233 stars 44 forks source link

Fix missing whitespaces in exported paragraphs. #8

Closed scottoasis closed 8 years ago

scottoasis commented 8 years ago

In my last patch, I used replace-regexp-in-string to trim newline character \n at the end of each line. Unfortunately, it concatenates two (or more) lines directly without inserting whitespaces in-between. This patch should fix the aforementioned bug.

For this modification, a lisp function split-string from subr.el is used. split-string makes no assumption about whitespaces at the start or the end of input string, so it is safer, as quoted from its documentation:

If you want to trim whitespace from the substrings, the reliably correct way is using TRIM. Making SEPARATORS match that whitespace gives incorrect results when there is whitespace at the start or end of STRING. If you see such calls to ‘split-string’, please fix them.

Also, I have made a living example in my fork of orgmk.

Thanks.

larstvei commented 8 years ago

Thanks!