mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-28 10:26:33 +02:00
refactor: improve Markdown fence handling in report generation and viewer
This commit is contained in:
parent
f7bbce098b
commit
8ae37bdccf
2 changed files with 16 additions and 7 deletions
|
|
@ -24,8 +24,9 @@ interface MarkdownViewerProps {
|
|||
*/
|
||||
function stripOuterMarkdownFence(content: string): string {
|
||||
const trimmed = content.trim();
|
||||
const match = trimmed.match(/^```(?:markdown|md)?\s*\n([\s\S]+?)\n```\s*$/);
|
||||
return match ? match[1] : content;
|
||||
// Match 3+ backtick fences (LLMs escalate to 4+ when content has triple-backtick blocks)
|
||||
const match = trimmed.match(/^(`{3,})(?:markdown|md)?\s*\n([\s\S]+?)\n\1\s*$/);
|
||||
return match ? match[2] : content;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue