refactor: 🎨 deno fmt

This commit is contained in:
Julien Oculi 2024-07-02 13:56:47 +02:00
parent d62305ac1d
commit 640f144417
3 changed files with 32 additions and 34 deletions

View file

@ -3,29 +3,27 @@ import { render, RenderOptions } from 'gfm'
export type MarkdownTheme = 'light' | 'dark' | 'auto'
export function Markdown(
{ children, theme, options }: {
children?: SignalLike<string> | string
theme?: SignalLike<MarkdownTheme> | MarkdownTheme
options?: RenderOptions
},
{ children, theme, options }: {
children?: SignalLike<string> | string
theme?: SignalLike<MarkdownTheme> | MarkdownTheme
options?: RenderOptions
},
) {
return (
<div
class='markdown-body'
data-color-mode={typeof theme === 'string'
? theme
: theme?.value ?? 'auto'}
data-light-theme='light'
data-dark-theme='dark'
dangerouslySetInnerHTML={{
__html: render(
typeof children === 'string'
? children
: children?.value ?? '',
options,
),
}}
>
</div>
)
return (
<div
class='markdown-body'
data-color-mode={typeof theme === 'string'
? theme
: theme?.value ?? 'auto'}
data-light-theme='light'
data-dark-theme='dark'
dangerouslySetInnerHTML={{
__html: render(
typeof children === 'string' ? children : children?.value ?? '',
options,
),
}}
>
</div>
)
}

View file

@ -38,7 +38,7 @@ export default function App({ Component }: PageProps) {
type='image/x-icon'
/>
<link rel='stylesheet' href={asset('/main.css')} />
<link rel="stylesheet" href={asset('/imports/markdown_css')} />
<link rel='stylesheet' href={asset('/imports/markdown_css')} />
</Head>
<body>
<Header />

View file

@ -2,13 +2,13 @@ import { Handlers } from '$fresh/server.ts'
import { CSS, KATEX_CSS } from 'gfm'
export const handler: Handlers = {
GET() {
const styles = CSS + KATEX_CSS
return new Response(styles, {
headers: {
'Content-Type': 'text/css; charset=utf-8',
// TODO add cache headers and eTag
},
})
},
GET() {
const styles = CSS + KATEX_CSS
return new Response(styles, {
headers: {
'Content-Type': 'text/css; charset=utf-8',
// TODO add cache headers and eTag
},
})
},
}