Closed xynydev closed 5 months ago
I agree, I also had this idea. This module metadata should include the description and name too, and the site would just be built automatically from a list of those files.
I found this part in the Astro docs about fetching remote markdown: https://docs.astro.build/en/guides/markdown-content/#fetching-remote-markdown
It's possible, and I could make it happen like this:
// ExternalMarkdown.atro
---
const { src } = Astro.props
import { marked } from 'marked';
const response = await fetch(src);
const markdown = await response.text();
const content = marked.parse(markdown.split('\n').slice(1,-1).join('\n'));
---
<article set:html={content} />
<style>
article pre code {
white-space: pre-wrap;
word-wrap: break-word;
}
</style>
// rpm-ostree.mdx
---
title: rpm-ostree
description: A reference page in my new Starlight docs site.
---
import ExternalMarkdown from "@components/ExternalMarkdown.astro"
<ExternalMarkdown src="https://raw.githubusercontent.com/ublue-os/bling/main/modules/rpm-ostree/README.md"/>
There are a few problems, though
The only/best possible solution I see for this is retiring module README.md's and either:
description
, example-config
, etc. which would be individually ingested onto the website and built into docs pages.The WIP approach described above was commited in here: https://github.com/blue-build/website/commit/0ad58e46b0ad51ae3c67b860efa6fde6404e8200
I now think the module.yml
approach is probably better for longevity and having docs where the code is (can be updated in the same pr, etc.). We should totally bring in the module pages with the only slightly broken, but already implemented WIP way.
TODO: Make a plugin that takes links modules.json files as input and outputs module pages reference pages: https://starlight.astro.build/reference/plugins/. Look at https://github.com/HiDeoo/starlight-typedoc sourcecode for help.
This is done now! Now just need to do & merge the changes into the module repo (bling currently).
I realize now that a module.yml
wouldn't've been required here since I literally generate markdown files, but it allows for more longevity & programmatic reading of the reference pages I guess. For creating UIs or smth.
We could require module developers to create a
module.yml
file that defines inputs/yaml context and like a description. The defining valid fields would help with linting a user's recipe so that they know when they set something incorrectly.