From: Lady Date: Sat, 29 Jul 2023 21:07:01 +0000 (-0700) Subject: Allow wrapping around emdashes X-Git-Url: https://git.ladys.computer/Blog/commitdiff_plain/664f0b7ea1f5a918066683d679ee604b04908cdf Allow wrapping around emdashes --- diff --git a/build.js b/build.js index be96bcd..07eeb0a 100755 --- a/build.js +++ b/build.js @@ -74,10 +74,10 @@ const applyTransforms = function (node) { // it being rendered as an inline block. const prev = node.previousSibling; const prevText = prev?.nodeType == 3 ? prev.textContent : ""; - const prevWrap = prevText.match(/\S*$/u)[0]; + const prevWrap = prevText.match(/(?:(?!—)\S)*$/u)[0]; const next = node.nextSibling; const nextText = next?.nodeType == 3 ? next.textContent : ""; - const nextWrap = nextText.match(/^\S*/u)[0]; + const nextWrap = nextText.match(/^(?:(?!—)\S)*/u)[0]; if (prevWrap || nextWrap) { const span = LMN.span.style("White-Space: Pre")``; node.parentNode.replaceChild(span, node);