Conversation
|
| const blocks: string[] = []; | ||
| const blockRe = | ||
| /<p[\s\S]*?<\/p>|<h[1-6][\s\S]*?<\/h[1-6]>|<figure[\s\S]*?<\/figure>|<img[^>]*>/gi; | ||
| /<ul[\s\S]*?<\/ul>|<ol[\s\S]*?<\/ol>|<table[\s\S]*?<\/table>|<blockquote[\s\S]*?<\/blockquote>|<div[\s\S]*?<\/div>|<p[\s\S]*?<\/p>|<h[1-6][\s\S]*?<\/h[1-6]>|<figure[\s\S]*?<\/figure>|<img[^>]*>/gi; |
There was a problem hiding this comment.
| const blocks: string[] = []; | ||
| const blockRe = | ||
| /<p[\s\S]*?<\/p>|<h[1-6][\s\S]*?<\/h[1-6]>|<figure[\s\S]*?<\/figure>|<img[^>]*>/gi; | ||
| /<ul[\s\S]*?<\/ul>|<ol[\s\S]*?<\/ol>|<table[\s\S]*?<\/table>|<blockquote[\s\S]*?<\/blockquote>|<div[\s\S]*?<\/div>|<p[\s\S]*?<\/p>|<h[1-6][\s\S]*?<\/h[1-6]>|<figure[\s\S]*?<\/figure>|<img[^>]*>/gi; |
There was a problem hiding this comment.
If a chapter has a list, table, or <div> inside another of the same kind, the new blockRe stops at the inner closing tag. The splitter then drops outer closing tags left in text-free gaps. The reader gets broken markup even though the source was balanced. Match the full outer block before discarding gaps.
| async function fetchApiText(url: string): Promise<string> { | ||
| const text = await fetchText(url); | ||
| if (text.length > MAX_RESPONSE_CHARS) | ||
| throw new Error("Response too large to parse safely"); |
There was a problem hiding this comment.
Follow-up to #2604, which was merged before the last Greptile review findings on it could be addressed. This PR applies a full audit hardening pass to plugins/english/wetriedtls.ts:
Verified against captured fixtures: for normal content the parsed chapter output text is byte-identical to before (only dropped attributes/elements differ), and the file is formatted with the repo's Prettier config.