diff --git a/README.md b/README.md index 758716e..7f3b6c9 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,10 @@ -# Astro Starter Kit: Blog +# Astro-WikiBonsai -```sh -npm create astro@latest -- --template blog -``` +[](https://github.com/wikibonsai/wikibonsai) -[](https://stackblitz.com/github/withastro/astro/tree/latest/examples/blog) -[](https://codesandbox.io/p/sandbox/github/withastro/astro/tree/latest/examples/blog) -[](https://codespaces.new/withastro/astro?devcontainer_path=.devcontainer/blog/devcontainer.json) +An [Astro base blog](https://github.com/withastro/astro/tree/main/examples/blog) with [wikibonsai](https://github.com/wikibonsai/wikibonsai) support. + +ð Display your [ð WikiBonsai](https://github.com/wikibonsai/wikibonsai) digital garden for others. > ð§âð **Seasoned astronaut?** Delete this file. Have fun! @@ -38,6 +36,12 @@ Inside of your Astro project, you'll see the following folders and files: âââ tsconfig.json ``` +#todo + +- entries +- index + - when defining the tree in 'i.bonsai.md', be sure there is a single root node so that the entire tree is processed properly. + Astro looks for `.astro` or `.md` files in the `src/pages/` directory. Each page is exposed as a route based on its file name. There's nothing special about `src/components/`, but that's where we like to put any Astro/React/Vue/Svelte/Preact components. diff --git a/astro.config.mjs b/astro.config.mjs index 3b2f75c..5e14e55 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -1,10 +1,42 @@ -import { defineConfig } from 'astro/config'; -import mdx from '@astrojs/mdx'; +import { base, defineConfig } from 'astro/config'; import sitemap from '@astrojs/sitemap'; +import { remarkWikiRefs } from 'remark-wikirefs'; +import { remarkCaml } from 'remark-caml'; + +import { + resolveHtmlHref, + resolveHtmlText, + resolveEmbedContent, + generateForeRefsRemarkPlugin, +} from './src/wikibonsai/wikirefs'; + + // https://astro.build/config export default defineConfig({ - site: 'https://example.com', - integrations: [mdx(), sitemap()], + site: 'https://astro-wikibonsai.netlify.app', + integrations: [ + sitemap(), + ], + assetsInclude: true, + markdown: { + // Preserve Astro's default plugins: GitHub-flavored Markdown and Smartypants + extendDefaultPlugins: true, + // Applied to .md and .mdx files + remarkPlugins: [ + remarkCaml, + [ + remarkWikiRefs, + { + baseUrl: base, + resolveHtmlHref: resolveHtmlHref, + resolveHtmlText: resolveHtmlText, + resolveEmbedContent: resolveEmbedContent, + }, + ], + // this plugin is necessary for backrefs to work + generateForeRefsRemarkPlugin, + ], + }, }); diff --git a/package.json b/package.json index 2f30c86..e380ad6 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,16 @@ "name": "astro-wikibonsai", "type": "module", "version": "0.0.1", + "description": "A starter project for a WikiBonsai digital garden using the Astro static site generator.", + "license": "MIT", + "author": { + "name": "manunamz", + "email": "manuanmz@pm.me" + }, + "repository": { + "type": "git", + "url": "https://github.com/wikibonsai/astro-wikibonsai" + }, "scripts": { "dev": "astro dev", "start": "astro dev", @@ -13,6 +23,13 @@ "@astrojs/mdx": "^1.1.0", "@astrojs/rss": "^3.0.0", "@astrojs/sitemap": "^3.0.0", - "astro": "^3.1.4" + "astro": "^3.1.4", + "fast-glob": "^3.3.1", + "gray-matter": "^4.0.3", + "remark-caml": "^0.0.5-rm", + "remark-wikirefs": "^0.0.6-rm", + "semtree": "^0.0.2", + "unist-util-select": "^5.0.0", + "wikirefs": "^0.0.4" } -} \ No newline at end of file +} diff --git a/public/wikibonsai.svg b/public/wikibonsai.svg new file mode 100755 index 0000000..51ccace --- /dev/null +++ b/public/wikibonsai.svg @@ -0,0 +1,81 @@ + \ No newline at end of file diff --git a/src/components/BackRefs.astro b/src/components/BackRefs.astro new file mode 100644 index 0000000..2f57d46 --- /dev/null +++ b/src/components/BackRefs.astro @@ -0,0 +1,77 @@ +--- +// import { getCollection } from 'astro:content'; +import { generateBackRefs } from '../wikibonsai/backrefs'; + +const { frontmatter } = Astro.props; + +const res = await generateBackRefs(frontmatter.fname); +const backattrs = res.backattrs; +const backlinks = res.backlinks; +--- + +