blog/src/components/misc/Markdown.astro

143 lines
3.5 KiB
Plaintext
Raw Normal View History

2023-11-03 16:22:33 +08:00
---
2024-01-22 11:35:54 +08:00
import '@fontsource-variable/jetbrains-mono';
import '@fontsource-variable/jetbrains-mono/wght-italic.css';
2024-01-22 11:35:54 +08:00
2023-11-03 16:22:33 +08:00
interface Props {
class: string;
}
const className = Astro.props.class;
---
<div data-pagefind-body class=`prose dark:prose-invert prose-base max-w-none custom-md ${className}`>
2023-11-03 16:22:33 +08:00
<!--<div class="prose dark:prose-invert max-w-none custom-md">-->
<!--<div class="max-w-none custom-md">-->
<slot />
</div>
<style lang="stylus" is:global>
.custom-md
2023-11-12 19:35:53 +08:00
h1,h2,h3,h4,h5,h6
.anchor
2024-01-22 11:25:56 +08:00
margin: -0.125rem
2023-11-12 19:35:53 +08:00
margin-left: 0.2ch
2024-01-22 11:25:56 +08:00
padding: 0.125rem
user-select: none
2023-11-12 19:35:53 +08:00
opacity: 0
transition: opacity 0.15s ease-in-out, background 0.15s ease-in-out
.anchor-icon
margin-left: 0.45ch
margin-right: 0.45ch
&:hover
.anchor
opacity: 1
2023-11-03 16:22:33 +08:00
a
position: relative
background: none
2024-01-22 11:25:56 +08:00
margin: -0.25rem
padding: 0.25rem
border-radius: 0.375rem
2023-11-03 16:22:33 +08:00
color: var(--primary)
text-decoration-line: none;
/*&:after*/
/* content: ''*/
/* position: absolute*/
/* left: 2px*/
/* right: 2px*/
/* bottom: 4px*/
/* height: 6px*/
/* border-radius: 3px*/
/* background: var(--link-hover)*/
/* transition: background 0.15s ease-in-out;*/
/* z-index: -1;*/
&:hover
background: var(--link-hover)
&:active
background: var(--link-active)
/*&:after*/
/* background: var(--link-active)*/
code
2024-01-22 11:35:54 +08:00
font-family: 'JetBrains Mono Variable',ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace
2023-11-03 16:22:33 +08:00
background: var(--inline-code-bg)
color: var(--inline-code-color)
2024-01-22 11:25:56 +08:00
padding: 0.125rem 0.25rem
border-radius: 0.25rem
2023-11-03 16:22:33 +08:00
overflow: hidden
2024-01-25 16:09:00 +08:00
counter-reset: line
2023-11-03 16:22:33 +08:00
&:before
content: none
&:after
content: none
2024-01-25 16:09:00 +08:00
span.line
&:before
content: counter(line)
counter-increment: line
direction: rtl
display: inline-block
margin-right: 1rem
2024-02-18 18:24:00 +08:00
width: 1rem
2024-01-25 16:09:00 +08:00
color: rgba(255, 255, 255, 0.25)
2023-11-03 16:22:33 +08:00
pre
background: var(--codeblock-bg) !important
2024-01-22 11:25:56 +08:00
border-radius: 0.75rem
padding-left: 1.25rem
padding-right: 1.25rem
2023-11-03 16:22:33 +08:00
code
color: unset
font-size: 0.875rem
2023-11-03 16:22:33 +08:00
padding: 0
background: none
::selection
background: var(--codeblock-selection)
span.br::selection
background: var(--codeblock-selection)
ul
li
&::marker
color: var(--primary)
ol
li
&::marker
color: var(--primary)
blockquote
font-style: normal
2023-11-08 10:36:59 +08:00
font-weight: inherit
2023-11-03 16:22:33 +08:00
border-left-color: rgba(0,0,0,0)
position: relative;
&:before
content: ''
position: absolute
left: -0.25rem
display: block
transition: background 0.15s ease-in-out;
background: var(--btn-regular-bg)
height: 100%
width: 0.25rem
border-radius: 1rem
p
&:before
content: none
&:after
content: none
img
2024-01-22 11:25:56 +08:00
border-radius: 0.75rem
2023-11-03 16:22:33 +08:00
hr
border-color: var(--line-divider)
border-style: dashed
iframe
2024-01-22 11:25:56 +08:00
border-radius: 0.75rem
2023-11-03 16:22:33 +08:00
margin-left: auto
margin-right: auto
max-width: 100%
2024-01-22 11:25:56 +08:00
</style>
<style lang="css" is:global>
@tailwind base;
@tailwind components;
@tailwind utilities;
@layer components {
.custom-md h1 {
@apply text-3xl
}
}
</style>