davidmerfield / Typeset

An HTML pre-proces­sor for web ty­pog­ra­phy
https://typeset.lllllllllllllllll.com/
Creative Commons Zero v1.0 Universal
2.65k stars 54 forks source link

Punctuation substitution issue with inline elements #35

Closed davidmerfield closed 8 years ago

davidmerfield commented 8 years ago

An example to illustrate the issue (note the quotation marks):

Input:

   <p>How about "<a href="/foo">that</a>" said the old man.</p>

Output: How about ”that“ said the old man.

Expected: How about “that” said the old man.

Why does this happen?

This is because each text node is handled individually. In the example, the three text nodes are How about ", that and " said the old man..

Solutions

Compute the text content of block elements (p tags, blockquotes) and run the substitution on that, instead of on the nodes individually?

davidmerfield commented 8 years ago

Fixed in 4a3c8aa6ba9e64a0b2ae2d4cd4199aca9b617cf2