noway.moe/astro.config.mjs

61 lines
1.9 KiB
JavaScript

import { defineConfig } from 'astro/config';
import mdx from '@astrojs/mdx';
import sitemap from '@astrojs/sitemap';
//import cloudflare from "@astrojs/cloudflare";
import remarkGfm from "remark-gfm";
import remarkRehype from "remark-rehype";
import rehypePrettyCode from "rehype-pretty-code";
import json from "./public/themes/github_light.json" assert { type: "json" };
import tailwind from "@astrojs/tailwind";
const options = {
// Specify the theme to use or a custom theme json, in our case
// it will be a moonlight-II theme from
// https://github.com/atomiks/moonlight-vscode-theme/blob/master/src/moonlight-ii.json
theme: json,
// Callbacks to customize the output of the nodes
onVisitLine(node) {
// Prevent lines from collapsing in `display: grid` mode, and
// allow empty lines to be copy/pasted
if (node.children.length === 0) {
node.children = [{type: 'text', value: ' '}];
}
},
onVisitHighlightedLine(node) {
// Adding a class to the highlighted line
node.properties.className.push('highlighted');
},
};
// https://astro.build/config
export default defineConfig({
site: 'https://dev.noway.moe',
output: "static",
integrations: [mdx(), sitemap(), tailwind()],
build: {
format: "file",
inlineStylesheets: "auto",
},
markdown: {
gfm: true,
syntaxHighlight: false,
remarkPlugins: [
remarkGfm,
[remarkRehype, { clobberPrefix: "" }],
[rehypePrettyCode, options],
],
//shikiConfig: {
// // Choose from Shiki's built-in themes (or add your own)
// // https://github.com/shikijs/shiki/blob/main/docs/themes.md
// theme: 'dracula',
// // Add custom languages
// // Note: Shiki has countless langs built-in, including .astro!
// // https://github.com/shikijs/shiki/blob/main/docs/languages.md
// langs: ["c", "ssh-config"],
// // Enable word wrap to prevent horizontal scrolling
// wrap: true,
//},
}
});