-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathastro.config.ts
56 lines (48 loc) · 1.16 KB
/
astro.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// @ts-check
import { defineConfig } from 'astro/config';
import { visit } from "unist-util-visit";
import twemoji from "@twemoji/api"
import mdx from "@astrojs/mdx";
const remarkTwemoji = (options?: {
callback?: Function
attributes?: Function
base?: string
ext?: string
className?: string
size?: string | number
folder?: string
isReact?: boolean
}) => {
const settings = options || {};
function attributesCallback(rawText: string) {
return {
title: rawText
};
}
function transformer(tree: any) {
visit(tree, "text", node => {
const parsedNode = twemoji.parse(
node.value,
Object.assign({ attributes: attributesCallback }, settings) as any
);
node.type = "html";
// Check if 'isReact: true' is specified in options
node.value = settings.isReact ? parsedNode.replace(/class/g, "className") : parsedNode;
});
}
return transformer;
};
// https://astro.build/config
export default defineConfig({
output: 'static',
markdown: {
remarkPlugins: [
[remarkTwemoji, {}]
]
},
build: {
format: 'file'
},
integrations: [mdx()],
site: "https://thinliquid.dev"
});