为Astro添加NeoDB卡片

astro | workflow | 书影音游

前言

使用请遵循CC-BY-NC-SA 4.0

如何使用?

  1. 本博客的Github存储库获取: /src/components/mdrenders/remark-neodb-card.mjs点击跳转
  2. 创建remark-neodb-card.mjs,复制第一步的代码并在astro.config.mjs添加:
astro.config.mjs
37 collapsed lines
import { defineConfig } from 'astro/config';
import remarkFigureCaption from '@microflash/remark-figure-caption';
import remarkDirective from 'remark-directive';
import remarkCalloutDirectives from "./src/components/mdrenders/remark-callout-directives-customized.mjs"
import remarkNeoDB from "./src/components/mdrenders/remark-neodb-card.mjs"
import { remarkReadingTime } from './src/components/mdrenders/remark-reading-time.mjs';
import { remarkModifiedTime } from './src/components/mdrenders/remark-modified-time.mjs';
import { pluginCollapsibleSections } from '@expressive-code/plugin-collapsible-sections'
import sitemap from '@astrojs/sitemap';
import expressiveCode from "astro-expressive-code";
// https://astro.build/config
export default defineConfig({
site: 'https://blog.asyncx.top',
integrations: [sitemap(),
expressiveCode({
plugins: [pluginCollapsibleSections()],
themes: ['material-theme-ocean'],
styleOverrides: {
// You can also override styles
borderRadius: '10px',
borderWidth: '1px',
frames: {
},
},
defaultProps: {
// Enable word wrap by default
wrap: true,
// Disable wrapped line indentation for terminal languages
overridesByLang: {
// 'bash,ps,sh': { preserveIndent: false },
},
},
})
],
markdown: {
remarkPlugins: [remarkNeoDB],
2 collapsed lines
}
});
  1. 使用方式为++类别/ID++,你可以通过复制某个NeoDB的链接来得到.例如: https://neodb.social/movie/2O7n5MUqKupr9wtmAflybI, 其中movie/2O7n5MUqKupr9wtmAflybI就是类别和条目ID, 这意味着你只需要复制https://neodb.social/后面的部分并在两端带上++就可以使用.

演示(安利)环节

输入内容为:
++movie/63F9JoxdWImOJkhuf4OIhK++
++book/4RcTj1AilRVONB8RIKJSVA++
++game/2psMXUufasnomW0woLnlie++
⬆︎Say something to me.⬆︎