feat: add github alerts support (#1095)

This commit is contained in:
Stephen Zhou 2023-12-01 21:31:08 +08:00 committed by GitHub
parent 55db2992b7
commit bb98256042
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 26 additions and 11 deletions

View File

@ -136,6 +136,7 @@
"remark-emoji": "4.0.0",
"remark-frontmatter": "4.0.1",
"remark-gfm": "3.0.1",
"remark-github-alerts": "^0.0.2",
"remark-math": "5.1.1",
"remark-parse": "10.0.2",
"remark-rehype": "10.1.0",

View File

@ -181,7 +181,7 @@ dependencies:
version: 0.16.9
langchain:
specifier: 0.0.196
version: 0.0.196(cheerio@1.0.0-rc.12)(ioredis@5.3.2)(jsdom@23.0.0)(ws@7.5.9)
version: 0.0.196(cheerio@1.0.0-rc.12)(ioredis@5.3.2)(jsdom@23.0.0)(ws@8.13.0)
lottie-react:
specifier: 2.4.0
version: 2.4.0(react-dom@18.2.0)(react@18.2.0)
@ -323,6 +323,9 @@ dependencies:
remark-gfm:
specifier: 3.0.1
version: 3.0.1
remark-github-alerts:
specifier: ^0.0.2
version: 0.0.2(@types/mdast@4.0.3)(unified@10.1.2)
remark-math:
specifier: 5.1.1
version: 5.1.1
@ -3446,12 +3449,6 @@ packages:
dependencies:
undici-types: 5.26.5
/@types/node@20.9.4:
resolution: {integrity: sha512-wmyg8HUhcn6ACjsn8oKYjkN/zUzQeNtMy44weTJSM6p4MMzEOuKbA3OjJ267uPCOW7Xex9dyrNTful8XTQYoDA==}
dependencies:
undici-types: 5.26.5
dev: true
/@types/pangu@4.0.2:
resolution: {integrity: sha512-rVwVCkOFTWpmBjZuxTiVhLE8cwIKff3jWEKjs+DDg6bMkQwjp9Bp03pNanHQTtTzP53SDHJutb/kfGFHNhOJaQ==}
dev: true
@ -7958,7 +7955,7 @@ packages:
resolution: {integrity: sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg==}
engines: {node: '>= 10.13.0'}
dependencies:
'@types/node': 20.9.4
'@types/node': 20.10.0
merge-stream: 2.0.0
supports-color: 8.1.1
dev: true
@ -8207,7 +8204,7 @@ packages:
uuid: 9.0.1
dev: false
/langchain@0.0.196(cheerio@1.0.0-rc.12)(ioredis@5.3.2)(jsdom@23.0.0)(ws@7.5.9):
/langchain@0.0.196(cheerio@1.0.0-rc.12)(ioredis@5.3.2)(jsdom@23.0.0)(ws@8.13.0):
resolution: {integrity: sha512-kt17GGTDFWHNv3jJOIXymsQxfa+h9UQ6hrHbhur+V2pV6RBKO5E+RRCvnCqBzbnOPtrlkENF6Wl3Ezmsfo21dg==}
engines: {node: '>=18'}
peerDependencies:
@ -8525,7 +8522,7 @@ packages:
openapi-types: 12.1.3
p-retry: 4.6.2
uuid: 9.0.1
ws: 7.5.9
ws: 8.13.0
yaml: 2.3.4
zod: 3.22.4
zod-to-json-schema: 3.20.3(zod@3.22.4)
@ -10892,6 +10889,17 @@ packages:
- supports-color
dev: false
/remark-github-alerts@0.0.2(@types/mdast@4.0.3)(unified@10.1.2):
resolution: {integrity: sha512-Sg12BXLjOSeyG4Td6nY514DFyccx3GU5Rq9ITfm0BlfM9JHPRwDYhkFzwNQwugXaykyjqhSw11lDBws1FXz5Ow==}
peerDependencies:
'@types/mdast': ^4.0.3
unified: ^11.0.4
dependencies:
'@types/mdast': 4.0.3
unified: 10.1.2
unist-util-visit: 5.0.0
dev: false
/remark-math@5.1.1:
resolution: {integrity: sha512-cE5T2R/xLVtfFI4cCePtiRn+e6jKMtFDR3P8V3qpv8wpKjwvHoBA4eJzvX+nVrnlNy0911bdGmuspCSwetfYHw==}
dependencies:

View File

@ -24,6 +24,9 @@ import Providers, { mantineDefaultColorScheme, mantineTheme } from "./providers"
import "@crossbell/connect-kit/colors.css"
import "@mantine/core/styles.css"
import "remark-github-alerts/styles/github-colors-light.css"
import "remark-github-alerts/styles/github-colors-dark-class.css"
import "remark-github-alerts/styles/github-base.css"
import "~/css/main.css"
export const metadata: Metadata = {
@ -125,7 +128,7 @@ export default async function RootLayout({
const messages = await getMessages()
return (
<html lang={params.locale} className={colorScheme}>
<html lang={params.locale} className={colorScheme} suppressHydrationWarning>
<head>
<ColorSchemeInjector />
<ColorSchemeScript />

View File

@ -24,6 +24,7 @@ import remarkDirectiveRehype from "remark-directive-rehype"
import emoji from "remark-emoji"
import remarkFrontmatter from "remark-frontmatter"
import remarkGfm from "remark-gfm"
import remarkGithubAlerts from "remark-github-alerts"
import remarkMath from "remark-math"
import remarkParse from "remark-parse"
import remarkRehype from "remark-rehype"
@ -104,6 +105,8 @@ export const renderPageContent = (
try {
let pipeline = unified()
.use(remarkParse)
// make sure this is before remarkBreaks
.use(remarkGithubAlerts)
.use(remarkBreaks)
.use(remarkFrontmatter, ["yaml"])
.use(() => (tree: Root) => {