我正在尝试将
shikiji-transformers
添加到我的 astro 项目中。无论我尝试做什么,我都无法让示例工作。
export function foo() {
console.log('Highlighted') // [!code highlight]
}
我必须遵循以下依赖关系:
"dependencies": {
"@astrojs/mdx": "^2.1.1",
"astro": "^4.4.0",
"astro-compress": "^2.2.10",
"shikiji-transformers": "^0.10.2",
}
以及以下配置:
import { defineConfig } from "astro/config";
import mdx from "@astrojs/mdx";
import * as transformers from 'shikiji-transformers';
const isProduction = process.env.NODE_ENV === 'production';
// https://astro.build/config
export default defineConfig({
site: "https://www.sanderboer.nl/",
prefetch: true,
markdown: {
syntaxHighlight: "shiki",
shikiConfig: {
// https://docs.astro.build/en/guides/markdown-content/#shiki-configuration
// https://shikiji.netlify.app/packages/transformers
transformers: Object.values(transformers)
},
},
integrations: [
mdx(),
],
});
import { defineConfig } from "astro/config";
import { transformerNotationHighlight } from 'shikiji-transformers';
export default defineConfig({
markdown: {
syntaxHighlight: "shiki",
shikiConfig: {
// https://docs.astro.build/en/guides/markdown-content/#shiki-configuration
// https://shikiji.netlify.app/packages/transformers
transformers: [
transformerNotationHighlight()
],
},
},
});