• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

clippingkk / web / #1041

10 Feb 2025 06:11PM UTC coverage: 0.749% (-0.007%) from 0.756%
#1041

push

AnnatarHe
fix: fix type error

31 of 371 branches covered (8.36%)

Branch coverage included in aggregate %.

0 of 3 new or added lines in 1 file covered. (0.0%)

156 of 24582 relevant lines covered (0.63%)

11.8 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/components/RichTextEditor/markdown-components.tsx
1
import { Components } from 'react-markdown'
×
2
import { cn } from '@/lib/utils'
×
NEW
3
import React from 'react'
×
4

×
5
type HeadingProps = {
×
6
  level: 1 | 2 | 3 | 4 | 5 | 6
×
7
  children: React.ReactNode
×
8
}
×
9

×
10
const Heading = ({ level, children }: HeadingProps) => {
×
11
  const className = cn(
×
12
    'font-bold tracking-tight',
×
13
    level === 1 && 'mb-8 bg-gradient-to-br from-gray-900 to-gray-600 bg-clip-text text-4xl text-transparent dark:from-gray-100 dark:to-gray-400',
×
14
    level === 2 && 'mb-6 bg-gradient-to-br from-gray-800 to-gray-600 bg-clip-text text-3xl text-transparent dark:from-gray-200 dark:to-gray-400',
×
15
    level === 3 && 'mb-4 text-2xl text-gray-800 dark:text-gray-200',
×
16
    level === 4 && 'mb-4 text-xl text-gray-800 dark:text-gray-200',
×
17
    level === 5 && 'mb-4 text-lg text-gray-800 dark:text-gray-200',
×
18
    level === 6 && 'mb-4 text-base text-gray-800 dark:text-gray-200'
×
19
  )
×
20

×
NEW
21
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
×
NEW
22
  const Tag = `h${level}` as any
×
23
  return <Tag className={className}>{children}</Tag>
×
24
}
×
25

×
26
export const MarkdownComponents: Components = {
×
27
  h1: ({ children }) => <Heading level={1}>{children}</Heading>,
×
28
  h2: ({ children }) => <Heading level={2}>{children}</Heading>,
×
29
  h3: ({ children }) => <Heading level={3}>{children}</Heading>,
×
30
  h4: ({ children }) => <Heading level={4}>{children}</Heading>,
×
31
  h5: ({ children }) => <Heading level={5}>{children}</Heading>,
×
32
  h6: ({ children }) => <Heading level={6}>{children}</Heading>,
×
33
  p: ({ children }) => (
×
34
    <p className='mb-6 leading-7 text-gray-700 dark:text-gray-300 [&:not(:first-child)]:mt-6'>
×
35
      {children}
×
36
    </p>
×
37
  ),
×
38
  a: ({ href, children }) => (
×
39
    <a
×
40
      href={href}
×
41
      target='_blank'
×
42
      rel='noopener noreferrer'
×
43
      className='bg-gradient-to-r from-blue-600 to-blue-400 bg-[length:0%_2px] bg-left-bottom bg-no-repeat px-1 text-blue-600 transition-all hover:bg-[length:100%_2px] hover:text-blue-500 dark:from-blue-400 dark:to-blue-300 dark:text-blue-400 dark:hover:text-blue-300'
×
44
    >
×
45
      {children}
×
46
    </a>
×
47
  ),
×
48
  strong: ({ children }) => (
×
49
    <strong className='font-bold text-gray-900 dark:text-white'>{children}</strong>
×
50
  ),
×
51
  em: ({ children }) => (
×
52
    <em className='italic text-gray-800 dark:text-gray-200'>{children}</em>
×
53
  ),
×
54
  code: ({ children }) => (
×
55
    <code className='rounded-md bg-gray-100 px-1.5 py-0.5 font-mono text-sm text-gray-900 dark:bg-gray-800 dark:text-gray-100'>
×
56
      {children}
×
57
    </code>
×
58
  ),
×
59
  pre: ({ children }) => (
×
60
    <pre className='mb-4 mt-6 overflow-x-auto rounded-lg bg-gray-100 p-4 dark:bg-gray-800/50'>
×
61
      {children}
×
62
    </pre>
×
63
  ),
×
64
  blockquote: ({ children }) => (
×
65
    <blockquote className='mt-6 border-l-4 border-gray-300 bg-gradient-to-r from-gray-100 to-transparent pl-6 italic text-gray-700 dark:border-gray-700 dark:from-gray-800 dark:to-transparent dark:text-gray-400'>
×
66
      {children}
×
67
    </blockquote>
×
68
  ),
×
69
  ul: ({ children }) => (
×
70
    <ul className='my-6 ml-6 list-disc space-y-2 text-gray-700 dark:text-gray-300 [&>li]:mt-2'>
×
71
      {children}
×
72
    </ul>
×
73
  ),
×
74
  ol: ({ children }) => (
×
75
    <ol className='my-6 ml-6 list-decimal space-y-2 text-gray-700 dark:text-gray-300 [&>li]:mt-2'>
×
76
      {children}
×
77
    </ol>
×
78
  ),
×
79
  li: ({ children }) => <li>{children}</li>,
×
80
  hr: () => <hr className='my-8 border-gray-200 dark:border-gray-800' />,
×
81
  img: ({ src, alt }) => (
×
82
    <img
×
83
      src={src}
×
84
      alt={alt}
×
85
      className='my-8 rounded-lg border border-gray-200 bg-gray-50 p-2 dark:border-gray-800 dark:bg-gray-900/50'
×
86
    />
×
87
  ),
×
88
  table: ({ children }) => (
×
89
    <div className='my-6 w-full overflow-y-auto'>
×
90
      <table className='w-full border-collapse text-sm'>{children}</table>
×
91
    </div>
×
92
  ),
×
93
  thead: ({ children }) => (
×
94
    <thead className='border-b border-gray-200 bg-gray-50 dark:border-gray-800 dark:bg-gray-900/50'>
×
95
      {children}
×
96
    </thead>
×
97
  ),
×
98
  tbody: ({ children }) => <tbody>{children}</tbody>,
×
99
  tr: ({ children }) => (
×
100
    <tr className='border-b border-gray-100 dark:border-gray-800 [&:last-child]:border-0'>
×
101
      {children}
×
102
    </tr>
×
103
  ),
×
104
  th: ({ children }) => (
×
105
    <th className='border-r border-gray-100 p-4 text-left font-medium text-gray-900 dark:border-gray-800 dark:text-gray-100 [&:last-child]:border-0'>
×
106
      {children}
×
107
    </th>
×
108
  ),
×
109
  td: ({ children }) => (
×
110
    <td className='border-r border-gray-100 p-4 text-gray-700 dark:border-gray-800 dark:text-gray-300 [&:last-child]:border-0'>
×
111
      {children}
×
112
    </td>
×
113
  ),
×
114
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc