turndown
turndown copied to clipboard
Content trimming
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
Not at the moment. What's your use case?
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>
:/
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:
)