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 type MarkdownTheme = 'light' | 'dark' | 'auto'
export function Markdown( export function Markdown(
{ children, theme, options }: { { children, theme, options }: {
children?: SignalLike<string> | string children?: SignalLike<string> | string
theme?: SignalLike<MarkdownTheme> | MarkdownTheme theme?: SignalLike<MarkdownTheme> | MarkdownTheme
options?: RenderOptions options?: RenderOptions
}, },
) { ) {
return ( return (
<div <div
class='markdown-body' class='markdown-body'
data-color-mode={typeof theme === 'string' data-color-mode={typeof theme === 'string'
? theme ? theme
: theme?.value ?? 'auto'} : theme?.value ?? 'auto'}
data-light-theme='light' data-light-theme='light'
data-dark-theme='dark' data-dark-theme='dark'
dangerouslySetInnerHTML={{ dangerouslySetInnerHTML={{
__html: render( __html: render(
typeof children === 'string' typeof children === 'string' ? children : children?.value ?? '',
? children options,
: children?.value ?? '', ),
options, }}
), >
}} </div>
> )
</div>
)
} }

View file

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

View file

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