Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,19 @@ interface MarkdownRendererProps {
content: string;
}

// Preprocessor to prevent setext heading interpretation of horizontal rules
// Ensures `---`, `***`, `___` are preceded by a blank line
function preprocessMarkdown(content: string): string {
return content.replace(/\n([^\n].*)\n(---+|___+|\*\*\*+)\n/g, "\n$1\n\n$2\n");
// Filter sycophantic opener phrases
const filtered = content.replace(
/^(You're|You are|That's|That is)\s+(absolutely|completely|totally|entirely)\s+(right|correct|exactly)[.,!:;—-]*\s*/gim,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't exactly be on the first group rather than the second?

"",
);

// Prevent setext heading interpretation of horizontal rules
// Ensures `---`, `***`, `___` are preceded by a blank line
return filtered.replace(
/\n([^\n].*)\n(---+|___+|\*\*\*+)\n/g,
"\n$1\n\n$2\n",
);
}

const fontStyle = {
Expand Down