styles: update markdown styles (#2005)
This commit is contained in:
@@ -8,10 +8,6 @@ import { oneLight } from 'react-syntax-highlighter/dist/cjs/styles/prism';
|
|||||||
import { Check, Copy } from './icons';
|
import { Check, Copy } from './icons';
|
||||||
import { visit } from 'unist-util-visit';
|
import { visit } from 'unist-util-visit';
|
||||||
|
|
||||||
const UrlTransform = {
|
|
||||||
a: ({ node, ...props }) => <a {...props} target="_blank" rel="noopener noreferrer" />,
|
|
||||||
};
|
|
||||||
|
|
||||||
function rehypeinlineCodeProperty() {
|
function rehypeinlineCodeProperty() {
|
||||||
return function (tree) {
|
return function (tree) {
|
||||||
if (!tree) return;
|
if (!tree) return;
|
||||||
@@ -86,7 +82,7 @@ export default function MarkdownContent({ content, className = '' }: MarkdownCon
|
|||||||
<ReactMarkdown
|
<ReactMarkdown
|
||||||
remarkPlugins={[remarkGfm]}
|
remarkPlugins={[remarkGfm]}
|
||||||
rehypePlugins={[rehypeinlineCodeProperty, rehypeRaw]}
|
rehypePlugins={[rehypeinlineCodeProperty, rehypeRaw]}
|
||||||
className={`prose prose-xs dark:prose-invert w-full max-w-full word-break
|
className={`prose prose-sm text-textStandard dark:prose-invert w-full max-w-full word-break
|
||||||
prose-pre:p-0 prose-pre:m-0 !p-0
|
prose-pre:p-0 prose-pre:m-0 !p-0
|
||||||
prose-code:break-all prose-code:whitespace-pre-wrap
|
prose-code:break-all prose-code:whitespace-pre-wrap
|
||||||
prose-table:table prose-table:w-full
|
prose-table:table prose-table:w-full
|
||||||
@@ -94,9 +90,17 @@ export default function MarkdownContent({ content, className = '' }: MarkdownCon
|
|||||||
prose-td:border prose-td:border-borderSubtle prose-td:p-2
|
prose-td:border prose-td:border-borderSubtle prose-td:p-2
|
||||||
prose-th:border prose-th:border-borderSubtle prose-th:p-2
|
prose-th:border prose-th:border-borderSubtle prose-th:p-2
|
||||||
prose-thead:bg-bgSubtle
|
prose-thead:bg-bgSubtle
|
||||||
|
prose-h1:text-2xl prose-h1:font-medium prose-h1:mb-5 prose-h1:mt-5
|
||||||
|
prose-h2:text-xl prose-h2:font-medium prose-h2:mb-4 prose-h2:mt-4
|
||||||
|
prose-h3:text-lg prose-h3:font-medium prose-h3:mb-3 prose-h3:mt-3
|
||||||
|
prose-p:mt-0 prose-p:mb-2
|
||||||
|
prose-ol:my-2
|
||||||
|
prose-ul:mt-0 prose-ul:mb-3
|
||||||
|
prose-li:m-0
|
||||||
|
|
||||||
${className}`}
|
${className}`}
|
||||||
components={{
|
components={{
|
||||||
...UrlTransform,
|
a: ({ node, ...props }) => <a {...props} target="_blank" rel="noopener noreferrer" />,
|
||||||
code({ node, className, children, inlinecode, ...props }) {
|
code({ node, className, children, inlinecode, ...props }) {
|
||||||
const match = /language-(\w+)/.exec(className || 'language-text');
|
const match = /language-(\w+)/.exec(className || 'language-text');
|
||||||
return inlinecode == 'false' && match ? (
|
return inlinecode == 'false' && match ? (
|
||||||
@@ -104,17 +108,12 @@ export default function MarkdownContent({ content, className = '' }: MarkdownCon
|
|||||||
) : (
|
) : (
|
||||||
<code
|
<code
|
||||||
{...props}
|
{...props}
|
||||||
className={`${className} break-all bg-inline-code dark:bg-inline-code-dark whitespace-pre-wrap`}
|
className={`break-all bg-inline-code dark:bg-inline-code-dark whitespace-pre-wrap`}
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
</code>
|
</code>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
// h3: 'div',
|
|
||||||
h3(props) {
|
|
||||||
const { node, ...rest } = props;
|
|
||||||
return <div className="text-textStandard text-sm" {...rest} />;
|
|
||||||
},
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{content}
|
{content}
|
||||||
|
|||||||
@@ -24,7 +24,10 @@ export default function UserMessage({ message }: UserMessageProps) {
|
|||||||
<div className="flex flex-col group">
|
<div className="flex flex-col group">
|
||||||
<div className="flex bg-slate text-white rounded-xl rounded-br-none py-2 px-3">
|
<div className="flex bg-slate text-white rounded-xl rounded-br-none py-2 px-3">
|
||||||
<div ref={contentRef}>
|
<div ref={contentRef}>
|
||||||
<MarkdownContent content={textContent} className="text-white prose-a:text-white" />
|
<MarkdownContent
|
||||||
|
content={textContent}
|
||||||
|
className="text-white prose-a:text-white user-message"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex justify-end">
|
<div className="flex justify-end">
|
||||||
|
|||||||
@@ -5,34 +5,34 @@
|
|||||||
/* Cash Sans */
|
/* Cash Sans */
|
||||||
|
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: Cash Sans;
|
font-family: 'Cash Sans';
|
||||||
src: url(https://cash-f.squarecdn.com/static/fonts/cashsans/woff2/CashSans-Regular.woff2)
|
src:
|
||||||
format('woff2');
|
url(https://cash-f.squarecdn.com/static/fonts/cashsans/woff2/CashSans-Regular.woff2)
|
||||||
|
format('woff2'),
|
||||||
|
url(https://cash-f.squarecdn.com/static/fonts/cashsans/woff/CashSans-Regular.woff)
|
||||||
|
format('woff');
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: Cash Sans;
|
font-family: 'Cash Sans';
|
||||||
src: url(https://cash-f.squarecdn.com/static/fonts/cashsans/woff2/CashSans-Medium.woff2)
|
src:
|
||||||
format('woff2');
|
url(https://cash-f.squarecdn.com/static/fonts/cashsans/woff2/CashSans-Medium.woff2)
|
||||||
|
format('woff2'),
|
||||||
|
url(https://cash-f.squarecdn.com/static/fonts/cashsans/woff/CashSans-Medium.woff) format('woff');
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: Cash Sans;
|
font-family: 'Cash Sans Mono';
|
||||||
src: url(https://cash-f.squarecdn.com/static/fonts/cashsans/woff2/CashSans-Semibold.woff2)
|
src:
|
||||||
format('woff2');
|
url(https://cash-f.squarecdn.com/static/fonts/cashsans/woff2/CashSansMono-Regular.woff2)
|
||||||
font-weight: 600;
|
format('woff2'),
|
||||||
font-style: normal;
|
url(https://cash-f.squarecdn.com/static/fonts/cashsans/woff/CashSansMono-Regular.woff)
|
||||||
}
|
format('woff');
|
||||||
|
font-weight: 400;
|
||||||
@font-face {
|
|
||||||
font-family: Cash Sans;
|
|
||||||
src: url(https://cash-f.squarecdn.com/static/fonts/cashsans/woff2/CashSans-Bold.woff2)
|
|
||||||
format('woff2');
|
|
||||||
font-weight: 700;
|
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -249,6 +249,7 @@
|
|||||||
word-wrap: break-word;
|
word-wrap: break-word;
|
||||||
word-break: break-word;
|
word-break: break-word;
|
||||||
}
|
}
|
||||||
|
|
||||||
.titlebar-drag-region {
|
.titlebar-drag-region {
|
||||||
-webkit-app-region: drag;
|
-webkit-app-region: drag;
|
||||||
height: 32px;
|
height: 32px;
|
||||||
@@ -265,8 +266,10 @@
|
|||||||
|
|
||||||
.bg-inline-code {
|
.bg-inline-code {
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
color: rgba(255, 130, 130, 0.85);
|
color: rgb(255 119 43);
|
||||||
font-family: 'Square Sans Mono';
|
background-color: var(--background-app);
|
||||||
|
border: 1px solid var(--border-subtle);
|
||||||
|
font-family: 'Cash Sans Mono', monospace;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
@@ -290,7 +293,7 @@
|
|||||||
content: '';
|
content: '';
|
||||||
}
|
}
|
||||||
|
|
||||||
.dark .bg-inline-code {
|
.user-message p {
|
||||||
color: rgba(248, 155, 89, 0.7);
|
margin-bottom: 0 !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ export default {
|
|||||||
extend: {
|
extend: {
|
||||||
fontFamily: {
|
fontFamily: {
|
||||||
sans: ['Cash Sans', 'sans-serif'],
|
sans: ['Cash Sans', 'sans-serif'],
|
||||||
|
mono: ['Cash Sans Mono', 'monospace'],
|
||||||
},
|
},
|
||||||
keyframes: {
|
keyframes: {
|
||||||
shimmer: {
|
shimmer: {
|
||||||
@@ -73,6 +74,13 @@ export default {
|
|||||||
blockTeal: 'var(--block-teal)',
|
blockTeal: 'var(--block-teal)',
|
||||||
blockOrange: 'var(--block-orange)',
|
blockOrange: 'var(--block-orange)',
|
||||||
},
|
},
|
||||||
|
typography: {
|
||||||
|
DEFAULT: {
|
||||||
|
css: {
|
||||||
|
color: 'var(--text-standard)',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user