Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

527 B
Raw Blame
const MARKDOWN_LINK = /\[([^\]]+)\]\(\s*(?:https?:\/\/)?[^)\s]*\s*\)/g;
const LABELED_LINK = /<(?:https?:\/\/[^>|\s]+)\|([^>]*)>/g;
const BARE_LINK = /<(https?:\/\/[^>\s]+)>/g;
const CODE_FENCE = /```+/g;
const BACKTICK = /`/g;
const WHITESPACE = /\s+/g;

export function singleLineTitle(title: string): string {
  return title
    .replace(MARKDOWN_LINK, "$1")
    .replace(LABELED_LINK, "$1")
    .replace(BARE_LINK, "$1")
    .replace(CODE_FENCE, " ")
    .replace(BACKTICK, "")
    .replace(WHITESPACE, " ")
    .trim();
}