Skip to content

Commit 3109a41

Browse files
authored
fix: replace control character sentinel with plain ASCII to prevent rendering artifacts
1 parent fd3eedc commit 3109a41

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

docs/index.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1950,10 +1950,11 @@ <h3 id="panel-heading">Contents</h3>
19501950
}
19511951
if (!container) container = doc.body;
19521952

1953+
19531954
// Inject sentinel strings at <br> tags and block-level boundaries before
19541955
// reading textContent. This handles sites that use <br><br> for paragraphs
19551956
// (e.g. paulgraham.com) as well as sites that use <p> or <div> tags.
1956-
const SENTINEL = '\u0002\n\n';
1957+
const SENTINEL = '||INKCAST_BREAK||';
19571958
const BLOCK_TAGS = new Set(['P','H1','H2','H3','H4','H5','H6','LI','BLOCKQUOTE','PRE','TD','TH','DIV','TR','SECTION','ARTICLE']);
19581959
const tw = doc.createTreeWalker(container, NodeFilter.SHOW_ELEMENT);
19591960
const toMark = [];
@@ -1966,7 +1967,8 @@ <h3 id="panel-heading">Contents</h3>
19661967
.split(SENTINEL)
19671968
.map(s => s.trim())
19681969
.filter(Boolean)
1969-
.join('\n\n');
1970+
.join('\n\n')
1971+
.replace(/\|\|INKCAST_BREAK\|\|/g, '\n\n'); // strip any that leaked through
19701972
text = text.replace(/\r\n/g, '\n').replace(/\r/g, '\n').replace(/\n{3,}/g, '\n\n').trim();
19711973
if (text.length < 100) return null;
19721974

0 commit comments

Comments
 (0)