turndown icon indicating copy to clipboard operation
turndown copied to clipboard

Content trimming

Open fabioimpe opened this issue 6 years ago • 3 comments

Hi, just a question, is there any way to avoid trimming content during the conversion?

ex. <p>hello </p> should be converted in: hello <-- note the trailing whitespace

Thank you

fabioimpe avatar Apr 11 '18 13:04 fabioimpe

Not at the moment. What's your use case?

domchristie avatar Apr 29 '18 10:04 domchristie

I should add: whitespace is significant in markdown, so to avoid potential issues when the resulting markdown is parsed, the input is stripped of all insignificant whitespace, and trimmed. For example, if whitespace were not trimmed in <em>hello world </em>, then this would convert to _hello world _, which when parsed would result in: <p>_hello world _</p> :/

domchristie avatar Apr 29 '18 10:04 domchristie

Hi! I was wondering if you can find a way to only trim content when the element is strong, italic, etc? So, <em>hello world </em> will still be converted to _hello world_ and <p> hello world </p> would be converted to hello world (white space at the beginning and the end)

My use case: HTML: <span>Date:</span> 7/27/2023 11:00 AM to 12:00 PM Current markdown: Date:7/27/2023 11:00 AM to 12:00 PM Expected markdown: Date: 7/27/2023 11:00 AM to 12:00 PM (whitespace after Date:)

gabibianconi avatar Jul 11 '23 13:07 gabibianconi