refactor: 🎨 deno fmt
This commit is contained in:
parent
d62305ac1d
commit
640f144417
|
@ -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>
|
||||
)
|
||||
}
|
||||
|
|
|
@ -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 />
|
||||
|
|
|
@ -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
|
||||
},
|
||||
})
|
||||
},
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue