downgraded

This commit is contained in:
tonyrewin 2022-10-04 14:38:57 +03:00
parent fc26e25cf0
commit 673b4bf26b
5 changed files with 20 additions and 34 deletions

View File

@ -9,6 +9,7 @@ import { markdownOptions as markdown } from './mdx.config'
import type { CSSOptions } from 'vite'
import defaultGenerateScopedName from 'postcss-modules/build/generateScopedName'
import { isDev } from './src/utils/config'
import { fileURLToPath, URL } from 'url'
const PATH_PREFIX = '/src/'
@ -62,7 +63,8 @@ const astroConfig: AstroUserConfig = {
},
resolve: {
alias: {
'@': './src'
'./runtimeConfig': './runtimeConfig.browser',
'@': fileURLToPath(new URL('src', import.meta.url))
}
},
css

View File

@ -1,26 +1,34 @@
import type { AstroUserConfig } from 'astro'
import type { RehypePlugin } from '@astrojs/markdown-remark'
import { selectAll } from 'hast-util-select'
import rehypeToc from '@jsdevtools/rehype-toc'
import rehypeAutolinkHeadings from 'rehype-autolink-headings'
import rehypeSlug from 'rehype-slug'
import remarkCodeTitles from 'remark-code-titles'
const write =
(cl) =>
({ properties }) => {
properties.className = properties.className ? properties.className + ' ' + cl : cl
}
const adder = ([selector, className]) => {
const writer = write(className)
return (node) => selectAll(selector, node).forEach((el) => writer(el as any))
}
const addClasses = (additions) => {
const adders = Object.entries(additions).map((entry) => adder(entry))
return (node) => adders.forEach((a) => a(node))
}
export const markdownOptions: AstroUserConfig['markdown'] = {
// remarkPlugins: ['remark-code-titles'],
remarkPlugins: [remarkCodeTitles],
rehypePlugins: [
// 'rehype-slug',
// ['rehype-autolink-headings', { behavior: 'prepend' }],
// ['rehype-toc', { headings: ['h2', 'h3'] }],
rehypeSlug,
[rehypeToc as RehypePlugin<any[]>, { headings: ['h1', 'h2', 'h3'] }],
[rehypeAutolinkHeadings, { behavior: 'prepend' }],
[addClasses, { 'h1,h2,h3': 'title' }]
]
],
extendDefaultPlugins: true
}

View File

@ -29,6 +29,7 @@
},
"dependencies": {
"@aws-sdk/client-s3": "^3.178.0",
"@jsdevtools/rehype-toc": "^3.0.2",
"@nanostores/persistent": "^0.7.0",
"@nanostores/router": "^0.7.0",
"@nanostores/solid": "^0.3.0",
@ -40,7 +41,6 @@
"postcss-modules": "^5.0.0",
"rehype-autolink-headings": "^6.1.1",
"rehype-slug": "^5.0.1",
"rehype-toc": "^3.0.2",
"remark-code-titles": "^0.1.2"
},
"devDependencies": {

View File

@ -1,24 +1,7 @@
{
"extends": "astro/tsconfigs/strict",
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"importsNotUsedAsValues": "error",
// Solid specific settings
"jsx": "preserve",
"jsxImportSource": "solid-js",
// Enable top-level await and other modern ESM features.
"target": "ESNext",
"module": "ESNext",
// Enable node-style module resolution, for things like npm package imports.
"moduleResolution": "node",
// Enable JSON imports.
"resolveJsonModule": true,
// Enable stricter transpilation for better output.
"isolatedModules": true,
// Astro will directly run your TypeScript code, no transpilation needed.
"noEmit": true,
"skipLibCheck": true
},
"paths": {
"@": ["./src"]
"jsxImportSource": "solid-js"
}
}

View File

@ -2353,7 +2353,7 @@
"@jridgewell/resolve-uri" "^3.0.3"
"@jridgewell/sourcemap-codec" "^1.4.10"
"@jsdevtools/rehype-toc@3.0.2":
"@jsdevtools/rehype-toc@^3.0.2":
version "3.0.2"
resolved "https://registry.yarnpkg.com/@jsdevtools/rehype-toc/-/rehype-toc-3.0.2.tgz#29c32e6b40cd4b5dafd96cb90d5057ac5dab4a51"
integrity sha512-n5JEf16Wr4mdkRMZ8wMP/wN9/sHmTjRPbouXjJH371mZ2LEGDl72t8tEsMRNFerQN/QJtivOxqK1frdGa4QK5Q==
@ -9818,13 +9818,6 @@ rehype-stringify@^9.0.0, rehype-stringify@^9.0.3:
hast-util-to-html "^8.0.0"
unified "^10.0.0"
rehype-toc@^3.0.2:
version "3.0.2"
resolved "https://registry.yarnpkg.com/rehype-toc/-/rehype-toc-3.0.2.tgz#0373e2abafddeb0606ee38229ff6714da6d86d68"
integrity sha512-DMt376+4i1KJGgHJL7Ezd65qKkJ7Eqp6JSB47BJ90ReBrohI9ufrornArM6f4oJjP2E2DVZZHufWucv/9t7GUQ==
dependencies:
"@jsdevtools/rehype-toc" "3.0.2"
rehype@^12.0.1:
version "12.0.1"
resolved "https://registry.yarnpkg.com/rehype/-/rehype-12.0.1.tgz#68a317662576dcaa2565a3952e149d6900096bf6"