html attributes with single quotes produce invalid output
milahu opened this issue · comments
html single quotes are converted to doublequotes
but doublequotes in the attribute value are not escaped
input.md
# test
<div title='hello "world" again'>
hover me
</div>
output.html
<h1>test</h1>
<div title="hello "world" again">
hover me
</div>
expected: either/or
- keep single quotes in attributes, and hope that the input is valid html
- convert attributes to double quotes, and escape
"
to"
in attribute values
Can you say more about why it appears to be converted for you? Pasting your example, then HTML looks like:
> rg "hover me" book/chapter_1.html
147: hover me
~/Temp/z47> rg -C4 "hover me" book/chapter_1.html
143- <div id="content" class="content">
144- <main>
145- <h1 id="test"><a class="header" href="#test">test</a></h1>
146-<div title='hello "world" again'>
147: hover me
148-</div>
149-
150- </main>
151-
If you are looking at the source via the DOM inspector, then I believe that is just the way it is displayed. The attribute should still have the value with the double quotes:
Here it shows the DOM value is the string as expected.
If you are looking at the source via the DOM inspector
yes ...
the "view page source" source is correct: single quotes are preserved
my actual problem is empty lines in html
<div title="hello
world">
hover me
</div>
which of course breaks the markup
sorry for the noise