mirror of
https://github.com/reonokiy/blog.nokiy.net.git
synced 2025-06-15 11:12:54 +02:00
test: code block style
This commit is contained in:
parent
85de183ccc
commit
dc24da0cb7
13 changed files with 206 additions and 277 deletions
|
@ -29,7 +29,7 @@ Retypeset 是一款基于 [Astro](https://astro.build/) 框架的静态博客主
|
|||
## 特征
|
||||
|
||||
- 基于 Astro 与 UnoCSS 开发
|
||||
- 支持 SEO、 Sitemap、 OpenGraph、 TOC、 RSS、 MDX 和 LaTeX
|
||||
- 支持 SEO、Sitemap、OpenGraph、TOC、RSS、MDX 和 LaTeX
|
||||
- i18n 多语言
|
||||
- 亮色/暗色模式
|
||||
- 优雅的过渡动画
|
||||
|
|
|
@ -6,8 +6,8 @@ import { generateDescription } from '@/utils/description'
|
|||
import { isTagPage } from '@/utils/page'
|
||||
|
||||
type Post = CollectionEntry<'posts'> & {
|
||||
remarkPluginFrontmatter?: {
|
||||
minutes?: number
|
||||
remarkPluginFrontmatter: {
|
||||
minutes: number
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,7 @@ function getPostPath(post: Post) {
|
|||
>
|
||||
<PostDate
|
||||
date={post.data.published}
|
||||
minutes={post.remarkPluginFrontmatter?.minutes}
|
||||
minutes={post.remarkPluginFrontmatter.minutes}
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
@ -64,7 +64,7 @@ function getPostPath(post: Post) {
|
|||
>
|
||||
<PostDate
|
||||
date={post.data.published}
|
||||
minutes={post.remarkPluginFrontmatter?.minutes}
|
||||
minutes={post.remarkPluginFrontmatter.minutes}
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ export const themeConfig: ThemeConfig = {
|
|||
// site subtitle
|
||||
subtitle: 'Revive the beauty of typography',
|
||||
// site description
|
||||
description: 'Retypeset is a static blog theme based on the Astro framework, inspired by Typography. Retypeset establishes a new visual standard and reimagines the layout of all pages, offering a reading experience similar to paper books, reviving the beauty of typography. Details in every sight, elegance in every space.',
|
||||
description: 'Retypeset is a static blog theme based on the Astro framework. Inspired by Typography, Retypeset establishes a new visual standard and reimagines the layout of all pages, creating a reading experience reminiscent of paper books, reviving the beauty of typography. Details in every sight, elegance in every space.',
|
||||
// use i18n title/subtitle/description from src/i18n/ui.ts instead of static ones above
|
||||
i18nTitle: true, // true, false
|
||||
// author name
|
||||
|
@ -37,7 +37,7 @@ export const themeConfig: ThemeConfig = {
|
|||
background: 'oklch(96% 0.005 298)',
|
||||
// code block theme
|
||||
// available themes: https://shiki.style/themes
|
||||
codeTheme: 'github-light',
|
||||
codeTheme: 'one-light ',
|
||||
},
|
||||
dark: {
|
||||
// primary color
|
||||
|
@ -51,7 +51,7 @@ export const themeConfig: ThemeConfig = {
|
|||
background: 'oklch(22% 0.005 298)',
|
||||
// code block theme
|
||||
// available themes: https://shiki.style/themes
|
||||
codeTheme: 'github-dark',
|
||||
codeTheme: 'one-dark-pro',
|
||||
},
|
||||
},
|
||||
// COLOR SETTINGS >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> END
|
||||
|
|
|
@ -8,78 +8,210 @@ pin: 1
|
|||
abbrlink: markdown-style-guide
|
||||
---
|
||||
|
||||
FROM https://github.com/saicaca/fuwari
|
||||
Here is a sample of some basic Markdown syntax that can be used when writing Markdown content in Astro.
|
||||
|
||||
## GitHub Repository Cards
|
||||
You can add dynamic cards that link to GitHub repositories, on page load, the repository information is pulled from the GitHub API.
|
||||
## Headings
|
||||
|
||||
::github{repo="Fabrizz/MMM-OnSpotify"}
|
||||
The following HTML `<h1>`—`<h6>` elements represent six levels of section headings. `<h1>` is the highest section level while `<h6>` is the lowest.
|
||||
|
||||
Create a GitHub repository card with the code `::github{repo="<owner>/<repo>"}`.
|
||||
# H1
|
||||
|
||||
## H2
|
||||
|
||||
### H3
|
||||
|
||||
#### H4
|
||||
|
||||
##### H5
|
||||
|
||||
###### H6
|
||||
|
||||
## Paragraph
|
||||
|
||||
Xerum, quo qui aut unt expliquam qui dolut labo. Aque venitatiusda cum, voluptionse latur sitiae dolessi aut parist aut dollo enim qui voluptate ma dolestendit peritin re plis aut quas inctum laceat est volestemque commosa as cus endigna tectur, offic to cor sequas etum rerum idem sintibus eiur? Quianimin porecus evelectur, cum que nis nust voloribus ratem aut omnimi, sitatur? Quiatem. Nam, omnis sum am facea corem alique molestrunt et eos evelece arcillit ut aut eos eos nus, sin conecerem erum fuga. Ri oditatquam, ad quibus unda veliamenimin cusam et facea ipsamus es exerum sitate dolores editium rerore eost, temped molorro ratiae volorro te reribus dolorer sperchicium faceata tiustia prat.
|
||||
|
||||
Itatur? Quiatae cullecum rem ent aut odis in re eossequodi nonsequ idebis ne sapicia is sinveli squiatum, core et que aut hariosam ex eat.
|
||||
|
||||
## Images
|
||||
|
||||
### Syntax
|
||||
|
||||
```markdown
|
||||
::github{repo="saicaca/fuwari"}
|
||||

|
||||
```
|
||||
|
||||
## Admonitions
|
||||
### Output
|
||||
|
||||
Following types of admonitions are supported: `note` `tip` `important` `warning` `caution`
|
||||

|
||||
|
||||
:::note
|
||||
Highlights information that users should take into account, even when skimming.
|
||||
:::
|
||||
## Blockquotes
|
||||
|
||||
:::tip
|
||||
Optional information to help a user be more successful.
|
||||
:::
|
||||
The blockquote element represents content that is quoted from another source, optionally with a citation which must be within a `footer` or `cite` element, and optionally with in-line changes such as annotations and abbreviations.
|
||||
|
||||
:::important
|
||||
Crucial information necessary for users to succeed.
|
||||
:::
|
||||
### Blockquote without attribution
|
||||
|
||||
:::warning
|
||||
Critical content demanding immediate user attention due to potential risks.
|
||||
:::
|
||||
|
||||
:::caution
|
||||
Negative potential consequences of an action.
|
||||
:::
|
||||
|
||||
### Basic Syntax
|
||||
#### Syntax
|
||||
|
||||
```markdown
|
||||
:::note
|
||||
Highlights information that users should take into account, even when skimming.
|
||||
:::
|
||||
|
||||
:::tip
|
||||
Optional information to help a user be more successful.
|
||||
:::
|
||||
> Tiam, ad mint andaepu dandae nostion secatur sequo quae.
|
||||
> **Note** that you can use _Markdown syntax_ within a blockquote.
|
||||
```
|
||||
|
||||
### Custom Titles
|
||||
#### Output
|
||||
|
||||
The title of the admonition can be customized.
|
||||
> Tiam, ad mint andaepu dandae nostion secatur sequo quae.
|
||||
> **Note** that you can use _Markdown syntax_ within a blockquote.
|
||||
|
||||
:::note[MY CUSTOM TITLE]
|
||||
This is a note with a custom title.
|
||||
:::
|
||||
### Blockquote with attribution
|
||||
|
||||
#### Syntax
|
||||
|
||||
```markdown
|
||||
:::note[MY CUSTOM TITLE]
|
||||
This is a note with a custom title.
|
||||
:::
|
||||
> Don't communicate by sharing memory, share memory by communicating.<br>
|
||||
> — <cite>Rob Pike[^1]</cite>
|
||||
```
|
||||
|
||||
### GitHub Syntax
|
||||
#### Output
|
||||
|
||||
> [!TIP]
|
||||
> [The GitHub syntax](https://github.com/orgs/community/discussions/16925) is also supported.
|
||||
> Don't communicate by sharing memory, share memory by communicating.<br>
|
||||
> — <cite>Rob Pike[^1]</cite>
|
||||
|
||||
[^1]: The above quote is excerpted from Rob Pike's [talk](https://www.youtube.com/watch?v=PAAkCSZUG1c) during Gopherfest, November 18, 2015.
|
||||
|
||||
## Tables
|
||||
|
||||
### Syntax
|
||||
|
||||
```markdown
|
||||
| Italics | Bold | Code |
|
||||
| --------- | -------- | ------ |
|
||||
| _italics_ | **bold** | `code` |
|
||||
```
|
||||
> [!NOTE]
|
||||
> The GitHub syntax is also supported.
|
||||
|
||||
> [!TIP]
|
||||
> The GitHub syntax is also supported.
|
||||
### Output
|
||||
|
||||
| Italics | Bold | Code |
|
||||
| --------- | -------- | ------ |
|
||||
| _italics_ | **bold** | `code` |
|
||||
|
||||
## Code Blocks
|
||||
|
||||
### Syntax
|
||||
|
||||
we can use 3 backticks ``` in new line and write snippet and close with 3 backticks on new line and to highlight language specific syntax, write one word of language name after first 3 backticks, for eg. html, javascript, css, markdown, typescript, txt, bash
|
||||
|
||||
````markdown
|
||||
```html
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Example HTML5 Document</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>Test</p>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
````
|
||||
|
||||
### Output
|
||||
|
||||
```html
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Example HTML5 Document</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>Test</p>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
## List Types
|
||||
|
||||
### Ordered List
|
||||
|
||||
#### Syntax
|
||||
|
||||
```markdown
|
||||
1. First item
|
||||
2. Second item
|
||||
3. Third item
|
||||
```
|
||||
|
||||
#### Output
|
||||
|
||||
1. First item
|
||||
2. Second item
|
||||
3. Third item
|
||||
|
||||
### Unordered List
|
||||
|
||||
#### Syntax
|
||||
|
||||
```markdown
|
||||
- List item
|
||||
- Another item
|
||||
- And another item
|
||||
```
|
||||
|
||||
#### Output
|
||||
|
||||
- List item
|
||||
- Another item
|
||||
- And another item
|
||||
|
||||
### Nested list
|
||||
|
||||
#### Syntax
|
||||
|
||||
```markdown
|
||||
- Fruit
|
||||
- Apple
|
||||
- Orange
|
||||
- Banana
|
||||
- Dairy
|
||||
- Milk
|
||||
- Cheese
|
||||
```
|
||||
|
||||
#### Output
|
||||
|
||||
- Fruit
|
||||
- Apple
|
||||
- Orange
|
||||
- Banana
|
||||
- Dairy
|
||||
- Milk
|
||||
- Cheese
|
||||
|
||||
## Other Elements — abbr, sub, sup, kbd, mark
|
||||
|
||||
### Syntax
|
||||
|
||||
```markdown
|
||||
<abbr title="Graphics Interchange Format">GIF</abbr> is a bitmap image format.
|
||||
|
||||
H<sub>2</sub>O
|
||||
|
||||
X<sup>n</sup> + Y<sup>n</sup> = Z<sup>n</sup>
|
||||
|
||||
Press <kbd>CTRL</kbd> + <kbd>ALT</kbd> + <kbd>Delete</kbd> to end the session.
|
||||
|
||||
Most <mark>salamanders</mark> are nocturnal, and hunt for insects, worms, and other small creatures.
|
||||
```
|
||||
|
||||
### Output
|
||||
|
||||
<abbr title="Graphics Interchange Format">GIF</abbr> is a bitmap image format.
|
||||
|
||||
H<sub>2</sub>O
|
||||
|
||||
X<sup>n</sup> + Y<sup>n</sup> = Z<sup>n</sup>
|
||||
|
||||
Press <kbd>CTRL</kbd> + <kbd>ALT</kbd> + <kbd>Delete</kbd> to end the session.
|
||||
|
||||
Most <mark>salamanders</mark> are nocturnal, and hunt for insects, worms, and other small creatures.
|
||||
|
|
|
@ -142,10 +142,15 @@ window
|
|||
{googleAnalyticsID && (
|
||||
<>
|
||||
<script
|
||||
is:inline
|
||||
type="text/partytown"
|
||||
src={customGoogleAnalyticsJS || `https://www.googletagmanager.com/gtag/js?id=${googleAnalyticsID}`}
|
||||
/>
|
||||
<script type="text/partytown" define:vars={{ googleAnalyticsID, customGoogleAnalyticsJS }}>
|
||||
<script
|
||||
is:inline
|
||||
type="text/partytown"
|
||||
define:vars={{ googleAnalyticsID, customGoogleAnalyticsJS }}
|
||||
>
|
||||
window.dataLayer = window.dataLayer || []
|
||||
function gtag(...args) {
|
||||
dataLayer.push(args)
|
||||
|
@ -167,6 +172,7 @@ window
|
|||
<!-- Umami Analytics -->
|
||||
{umamiAnalyticsID && (
|
||||
<script
|
||||
is:inline
|
||||
type="text/partytown"
|
||||
crossorigin="anonymous"
|
||||
data-website-id={umamiAnalyticsID}
|
||||
|
|
|
@ -95,7 +95,7 @@ const mobileFooterMargin = isPost && themeConfig.comment?.waline?.serverURL
|
|||
</div>
|
||||
|
||||
<!-- Theme toggle >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> -->
|
||||
<script define:vars={{ lightMode, darkMode }}>
|
||||
<script is:inline define:vars={{ lightMode, darkMode }}>
|
||||
// Update theme
|
||||
function updateTheme() {
|
||||
// Toggle website theme
|
||||
|
@ -151,7 +151,7 @@ const mobileFooterMargin = isPost && themeConfig.comment?.waline?.serverURL
|
|||
</script>
|
||||
|
||||
<!-- Back home >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> -->
|
||||
<script define:vars={{ localizedHome }}>
|
||||
<script is:inline define:vars={{ localizedHome }}>
|
||||
function setupBackButton() {
|
||||
document.getElementById('back-button')?.addEventListener('click', () => {
|
||||
if (document.referrer) {
|
||||
|
|
|
@ -1,33 +0,0 @@
|
|||
/// <reference types="mdast" />
|
||||
import { h } from 'hastscript'
|
||||
|
||||
/**
|
||||
* Creates an admonition component.
|
||||
*
|
||||
* param {object} properties - The properties of the component.
|
||||
* param {string} [properties.title] - An optional title.
|
||||
* param {('tip'|'note'|'important'|'caution'|'warning')} type - The admonition type.
|
||||
* param {import('mdast').RootContent[]} children - The children elements of the component.
|
||||
* returns {import('mdast').Parent} The created admonition component.
|
||||
*/
|
||||
export function AdmonitionComponent(properties, children, type) {
|
||||
if (!Array.isArray(children) || children.length === 0) {
|
||||
return h(
|
||||
'div',
|
||||
{ class: 'hidden' },
|
||||
'Invalid admonition directive. (Admonition directives must be of block type ":::note{name="name"} <content> :::")',
|
||||
)
|
||||
}
|
||||
|
||||
let label = null
|
||||
if (properties && properties['has-directive-label']) {
|
||||
label = children[0] // The first child is the label
|
||||
children = children.slice(1)
|
||||
label.tagName = 'div' // Change the tag <p> to <div>
|
||||
}
|
||||
|
||||
return h(`blockquote`, { class: `admonition bdm-${type}` }, [
|
||||
h('span', { class: `bdm-title` }, label || type.toUpperCase()),
|
||||
...children,
|
||||
])
|
||||
}
|
|
@ -1,105 +0,0 @@
|
|||
/// <reference types="mdast" />
|
||||
import { h } from 'hastscript'
|
||||
|
||||
/**
|
||||
* Creates a GitHub Card component.
|
||||
*
|
||||
* param {object} properties - The properties of the component.
|
||||
* param {string} properties.repo - The GitHub repository in the format "owner/repo".
|
||||
* param {import('mdast').RootContent[]} children - The children elements of the component.
|
||||
* returns {import('mdast').Parent} The created GitHub Card component.
|
||||
*/
|
||||
export function GithubCardComponent(properties, children) {
|
||||
if (Array.isArray(children) && children.length !== 0) {
|
||||
return h('div', { class: 'hidden' }, [
|
||||
'Invalid directive. ("github" directive must be leaf type "::github{repo="owner/repo"}")',
|
||||
])
|
||||
}
|
||||
|
||||
if (!properties.repo || !properties.repo.includes('/')) {
|
||||
return h(
|
||||
'div',
|
||||
{ class: 'hidden' },
|
||||
'Invalid repository. ("repo" attribute must be in the format "owner/repo")',
|
||||
)
|
||||
}
|
||||
|
||||
const repo = properties.repo
|
||||
const cardUuid = `GC${Math.random().toString(36).slice(-6)}` // Collisions are not important
|
||||
|
||||
const nAvatar = h(`div#${cardUuid}-avatar`, { class: 'gc-avatar' })
|
||||
const nLanguage = h(
|
||||
`span#${cardUuid}-language`,
|
||||
{ class: 'gc-language' },
|
||||
'Waiting...',
|
||||
)
|
||||
|
||||
const nTitle = h(`div`, { class: 'gc-titlebar' }, [
|
||||
h('div', { class: 'gc-titlebar-left' }, [
|
||||
h('div', { class: 'gc-owner' }, [
|
||||
nAvatar,
|
||||
h('div', { class: 'gc-user' }, repo.split('/')[0]),
|
||||
]),
|
||||
h('div', { class: 'gc-divider' }, '/'),
|
||||
h('div', { class: 'gc-repo' }, repo.split('/')[1]),
|
||||
]),
|
||||
h('div', { class: 'github-logo' }),
|
||||
])
|
||||
|
||||
const nDescription = h(
|
||||
`div#${cardUuid}-description`,
|
||||
{ class: 'gc-description' },
|
||||
'Waiting for api.github.com...',
|
||||
)
|
||||
|
||||
const nStars = h(`div#${cardUuid}-stars`, { class: 'gc-stars' }, '00K')
|
||||
const nForks = h(`div#${cardUuid}-forks`, { class: 'gc-forks' }, '0K')
|
||||
const nLicense = h(`div#${cardUuid}-license`, { class: 'gc-license' }, '0K')
|
||||
|
||||
const nScript = h(
|
||||
`script#${cardUuid}-script`,
|
||||
{ type: 'text/javascript', defer: true },
|
||||
`
|
||||
fetch('https://api.github.com/repos/${repo}', { referrerPolicy: "no-referrer" }).then(response => response.json()).then(data => {
|
||||
if (data.description) {
|
||||
document.getElementById('${cardUuid}-description').innerText = data.description.replace(/:[a-zA-Z0-9_]+:/g, '');
|
||||
} else {
|
||||
document.getElementById('${cardUuid}-description').innerText = "Description not set"
|
||||
}
|
||||
document.getElementById('${cardUuid}-language').innerText = data.language;
|
||||
document.getElementById('${cardUuid}-forks').innerText = Intl.NumberFormat('en-us', { notation: "compact", maximumFractionDigits: 1 }).format(data.forks).replaceAll("\u202F", '');
|
||||
document.getElementById('${cardUuid}-stars').innerText = Intl.NumberFormat('en-us', { notation: "compact", maximumFractionDigits: 1 }).format(data.stargazers_count).replaceAll("\u202F", '');
|
||||
const avatarEl = document.getElementById('${cardUuid}-avatar');
|
||||
avatarEl.style.backgroundImage = 'url(' + data.owner.avatar_url + ')';
|
||||
avatarEl.style.backgroundColor = 'transparent';
|
||||
if (data.license?.spdx_id) {
|
||||
document.getElementById('${cardUuid}-license').innerText = data.license?.spdx_id
|
||||
} else {
|
||||
document.getElementById('${cardUuid}-license').innerText = "no-license"
|
||||
};
|
||||
document.getElementById('${cardUuid}-card').classList.remove("fetch-waiting");
|
||||
console.log("[GITHUB-CARD] Loaded card for ${repo} | ${cardUuid}.")
|
||||
}).catch(err => {
|
||||
const c = document.getElementById('${cardUuid}-card');
|
||||
c.classList.add("fetch-error");
|
||||
console.warn("[GITHUB-CARD] (Error) Loading card for ${repo} | ${cardUuid}.")
|
||||
})
|
||||
`,
|
||||
)
|
||||
|
||||
return h(
|
||||
`a#${cardUuid}-card`,
|
||||
{
|
||||
class: 'card-github fetch-waiting no-styling',
|
||||
href: `https://github.com/${repo}`,
|
||||
target: '_blank',
|
||||
repo,
|
||||
},
|
||||
[
|
||||
nTitle,
|
||||
nDescription,
|
||||
h('div', { class: 'gc-infobar' }, [nStars, nForks, nLicense, nLanguage]),
|
||||
nScript,
|
||||
],
|
||||
)
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
import { visit } from 'unist-util-visit'
|
||||
|
||||
export function rehypeImgToFigure() {
|
||||
return (tree) => {
|
||||
visit(tree, 'element', (node) => {
|
||||
if (node.tagName !== 'p' || !node.children)
|
||||
return
|
||||
|
||||
const child = node.children[0]
|
||||
if (!child || child.tagName !== 'img')
|
||||
return
|
||||
|
||||
const altText = child.properties.alt
|
||||
if (!altText)
|
||||
return
|
||||
|
||||
node.tagName = 'figure'
|
||||
node.children = [
|
||||
child,
|
||||
{
|
||||
type: 'element',
|
||||
tagName: 'figcaption',
|
||||
properties: {},
|
||||
children: [{ type: 'text', value: altText }],
|
||||
},
|
||||
]
|
||||
|
||||
child.properties.alt = ''
|
||||
})
|
||||
}
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
// biome-ignore lint/suspicious/noShadowRestrictedNames: <explanation>
|
||||
import { h } from 'hastscript'
|
||||
import { visit } from 'unist-util-visit'
|
||||
|
||||
export function parseDirectiveNode() {
|
||||
return (tree, _data) => {
|
||||
visit(tree, (node) => {
|
||||
if (
|
||||
node.type === 'containerDirective'
|
||||
|| node.type === 'leafDirective'
|
||||
|| node.type === 'textDirective'
|
||||
) {
|
||||
const data = node.data || (node.data = {})
|
||||
node.attributes = node.attributes || {}
|
||||
if (
|
||||
node.children.length > 0
|
||||
&& node.children[0].data
|
||||
&& node.children[0].data.directiveLabel
|
||||
) {
|
||||
// Add a flag to the node to indicate that it has a directive label
|
||||
node.attributes['has-directive-label'] = true
|
||||
}
|
||||
const hast = h(node.name, node.attributes)
|
||||
|
||||
data.hName = hast.tagName
|
||||
data.hProperties = hast.properties
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
import { toString } from 'mdast-util-to-string'
|
||||
|
||||
/* Use the post's first paragraph as the excerpt */
|
||||
export function remarkExcerpt() {
|
||||
return (tree, { data }) => {
|
||||
let excerpt = ''
|
||||
for (const node of tree.children) {
|
||||
if (node.type !== 'paragraph') {
|
||||
continue
|
||||
}
|
||||
excerpt = toString(node)
|
||||
break
|
||||
}
|
||||
data.astro.frontmatter.excerpt = excerpt
|
||||
}
|
||||
}
|
|
@ -20,6 +20,12 @@ body {
|
|||
--at-apply: 'cursor-zoom-in force-gpu';
|
||||
} */
|
||||
|
||||
html.dark .astro-code,
|
||||
html.dark .astro-code span {
|
||||
color: var(--shiki-dark) !important;
|
||||
background-color: var(--shiki-dark-bg) !important;
|
||||
}
|
||||
|
||||
/* Horizontal reveal animation during theme switching */
|
||||
::view-transition-new(theme-transition) {
|
||||
animation: reveal 1s cubic-bezier(0.4, 0, 0.2, 1);
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
margin-block-end:0 !important
|
||||
}
|
||||
.heti a {
|
||||
--at-apply: 'underline mx-0.25em decoration-secondary/25 font-medium underline-0.075em underline-offset-0.2em hover:(c-primary decoration-secondary/75 transition)';
|
||||
--at-apply: 'underline mx-0.25em decoration-secondary/25 font-medium underline-0.075em underline-offset-0.2em hover:(c-primary decoration-secondary/75 transition) lg:underline-0.1em';
|
||||
}
|
||||
.heti blockquote {
|
||||
margin-block-start:12px;
|
||||
|
@ -82,7 +82,7 @@
|
|||
.heti p:not(:lang(zh-CN)):not(:lang(zh-TW)):not(:lang(ja-JP)):not(:lang(ko-KR)) {
|
||||
text-align:start
|
||||
}
|
||||
.heti pre {
|
||||
/* .heti pre {
|
||||
margin-block-start:12px;
|
||||
margin-block-end:12px;
|
||||
margin-inline-start:0;
|
||||
|
@ -108,7 +108,7 @@
|
|||
border-radius:0;
|
||||
background-color:rgba(0,0,0,0);
|
||||
color:inherit
|
||||
}
|
||||
} */
|
||||
.heti a,.heti abbr,.heti code,.heti heti-spacing,.heti [lang=en-US] {
|
||||
letter-spacing:normal
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue