mirror of
https://git.mirrors.martin98.com/https://github.com/jina-ai/reader.git
synced 2025-08-19 13:09:08 +08:00
fix: turndown rules
This commit is contained in:
parent
340fb517d8
commit
b10931b8ed
@ -552,25 +552,10 @@ ${suffixMixins.length ? `\n${suffixMixins.join('\n\n')}\n` : ''}`;
|
||||
return delimiter + extraSpace + content + (delimiter === '```' && !content.endsWith(extraSpace) ? extraSpace : '') + delimiter;
|
||||
}
|
||||
});
|
||||
turnDownService.addRule('flattened-tables', {
|
||||
filter: (node) => {
|
||||
if (node.tagName !== 'TABLE') {
|
||||
return false;
|
||||
}
|
||||
let parentHasTable = false;
|
||||
let ptr = node.parentElement;
|
||||
while (ptr) {
|
||||
if (ptr.tagName === 'TABLE') {
|
||||
parentHasTable = true;
|
||||
break;
|
||||
}
|
||||
ptr = ptr.parentElement;
|
||||
}
|
||||
|
||||
return parentHasTable;
|
||||
},
|
||||
replacement: (innerText) => {
|
||||
return innerText.trim();
|
||||
turnDownService.addRule('picture', {
|
||||
filter: 'picture',
|
||||
replacement: (content, _node) => {
|
||||
return content;
|
||||
}
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user