Skip to content

Commit

Permalink
Merge branch 'saicaca-main'
Browse files Browse the repository at this point in the history
  • Loading branch information
NiuBoss123 committed Nov 10, 2024
2 parents f85175f + 07975a2 commit 37a3c42
Show file tree
Hide file tree
Showing 21 changed files with 2,563 additions and 2,474 deletions.
115 changes: 64 additions & 51 deletions astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
import sitemap from '@astrojs/sitemap';
import svelte from "@astrojs/svelte"
import tailwind from "@astrojs/tailwind"
import swup from '@swup/astro';
import Compress from "astro-compress"
import icon from "astro-icon"
import { defineConfig } from "astro/config"
import Color from "colorjs.io"
import rehypeAutolinkHeadings from "rehype-autolink-headings"
import rehypeComponents from "rehype-components"; /* Render the custom directive content */
import rehypeKatex from "rehype-katex"
import rehypeSlug from "rehype-slug"
import remarkDirective from "remark-directive" /* Handle directives */
import remarkGithubAdmonitionsToDirectives from "remark-github-admonitions-to-directives";
import remarkMath from "remark-math"
import { AdmonitionComponent } from "./src/plugins/rehype-component-admonition.mjs"
import { GithubCardComponent } from "./src/plugins/rehype-component-github-card.mjs"
import {parseDirectiveNode} from "./src/plugins/remark-directive-rehype.js";
import { remarkReadingTime } from "./src/plugins/remark-reading-time.mjs"
import {remarkExcerpt} from "./src/plugins/remark-excerpt.js";
import sitemap from '@astrojs/sitemap'
import svelte from '@astrojs/svelte'
import tailwind from '@astrojs/tailwind'
import swup from '@swup/astro'
import Compress from 'astro-compress'
import icon from 'astro-icon'
import { defineConfig } from 'astro/config'
import Color from 'colorjs.io'
import rehypeAutolinkHeadings from 'rehype-autolink-headings'
import rehypeComponents from 'rehype-components' /* Render the custom directive content */
import rehypeKatex from 'rehype-katex'
import rehypeSlug from 'rehype-slug'
import remarkDirective from 'remark-directive' /* Handle directives */
import remarkGithubAdmonitionsToDirectives from 'remark-github-admonitions-to-directives'
import remarkMath from 'remark-math'
import { AdmonitionComponent } from './src/plugins/rehype-component-admonition.mjs'
import { GithubCardComponent } from './src/plugins/rehype-component-github-card.mjs'
import { parseDirectiveNode } from './src/plugins/remark-directive-rehype.js'
import { remarkExcerpt } from './src/plugins/remark-excerpt.js'
import { remarkReadingTime } from './src/plugins/remark-reading-time.mjs'

const oklchToHex = (str) => {
const oklchToHex = str => {
const DEFAULT_HUE = 250
const regex = /-?\d+(\.\d+)?/g
const matches = str.string.match(regex)
const lch = [matches[0], matches[1], DEFAULT_HUE]
return new Color("oklch", lch).to("srgb").toString({
format: "hex",
return new Color('oklch', lch).to('srgb').toString({
format: 'hex',
})
}

Expand All @@ -41,7 +41,7 @@ export default defineConfig({
animationClass: 'transition-swup-', // see https://swup.js.org/options/#animationselector
// the default value `transition-` cause transition delay
// when the Tailwind class `transition-all` is used
containers: ['main'],
containers: ['main', '#toc'],
smoothScrolling: true,
cache: true,
preload: true,
Expand All @@ -52,10 +52,10 @@ export default defineConfig({
}),
icon({
include: {
"material-symbols": ["*"],
"fa6-brands": ["*"],
"fa6-regular": ["*"],
"fa6-solid": ["*"],
'material-symbols': ['*'],
'fa6-brands': ['*'],
'fa6-regular': ['*'],
'fa6-solid': ['*'],
},
}),
svelte(),
Expand All @@ -64,43 +64,53 @@ export default defineConfig({
CSS: false,
Image: false,
Action: {
Passed: async () => true, // https://github.com/PlayForm/Compress/issues/376
Passed: async () => true, // https://github.com/PlayForm/Compress/issues/376
},
}),
],
markdown: {
remarkPlugins: [remarkMath, remarkReadingTime, remarkExcerpt, remarkGithubAdmonitionsToDirectives, remarkDirective, parseDirectiveNode],
remarkPlugins: [
remarkMath,
remarkReadingTime,
remarkExcerpt,
remarkGithubAdmonitionsToDirectives,
remarkDirective,
parseDirectiveNode,
],
rehypePlugins: [
rehypeKatex,
rehypeSlug,
[rehypeComponents, {
components: {
github: GithubCardComponent,
note: (x, y) => AdmonitionComponent(x, y, "note"),
tip: (x, y) => AdmonitionComponent(x, y, "tip"),
important: (x, y) => AdmonitionComponent(x, y, "important"),
caution: (x, y) => AdmonitionComponent(x, y, "caution"),
warning: (x, y) => AdmonitionComponent(x, y, "warning"),
[
rehypeComponents,
{
components: {
github: GithubCardComponent,
note: (x, y) => AdmonitionComponent(x, y, 'note'),
tip: (x, y) => AdmonitionComponent(x, y, 'tip'),
important: (x, y) => AdmonitionComponent(x, y, 'important'),
caution: (x, y) => AdmonitionComponent(x, y, 'caution'),
warning: (x, y) => AdmonitionComponent(x, y, 'warning'),
},
},
}],
],
[
rehypeAutolinkHeadings,
{
behavior: "append",
behavior: 'append',
properties: {
className: ["anchor"],
className: ['anchor'],
},
content: {
type: "element",
tagName: "span",
type: 'element',
tagName: 'span',
properties: {
className: ["anchor-icon"],
className: ['anchor-icon'],
'data-pagefind-ignore': true,
},
children: [
{
type: "text",
value: "#",
type: 'text',
value: '#',
},
],
},
Expand All @@ -113,12 +123,15 @@ export default defineConfig({
rollupOptions: {
onwarn(warning, warn) {
// temporarily suppress this warning
if (warning.message.includes("is dynamically imported by") && warning.message.includes("but also statically imported by")) {
return;
if (
warning.message.includes('is dynamically imported by') &&
warning.message.includes('but also statically imported by')
) {
return
}
warn(warning);
}
}
warn(warning)
},
},
},
css: {
preprocessorOptions: {
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
"@astrojs/check": "^0.9.3",
"@astrojs/rss": "^4.0.7",
"@astrojs/sitemap": "^3.1.6",
"@astrojs/svelte": "^5.7.0",
"@astrojs/tailwind": "^5.1.0",
"@astrojs/svelte": "^5.7.1",
"@astrojs/tailwind": "^5.1.1",
"@fontsource-variable/jetbrains-mono": "^5.0.22",
"@fontsource/roboto": "^5.0.14",
"@swup/astro": "^1.4.1",
"astro": "^4.15.0",
"astro": "^4.15.9",
"astro-compress": "^2.3.1",
"astro-icon": "^1.1.1",
"colorjs.io": "^0.5.2",
Expand All @@ -47,7 +47,7 @@
"unist-util-visit": "^5.0.0"
},
"devDependencies": {
"@astrojs/ts-plugin": "^1.10.1",
"@astrojs/ts-plugin": "^1.10.2",
"@biomejs/biome": "1.8.3",
"@iconify-json/fa6-brands": "^1.1.22",
"@iconify-json/fa6-regular": "^1.1.22",
Expand Down
Loading

0 comments on commit 37a3c42

Please sign in to comment.