How to use <StarlightPage> in actual projects ? #3250
Replies: 1 comment
-
Thanks for the discussion. First, I'd like to mention that one important point is that Starlight is built on top Astro, and as we mention, many questions can be answered by checking Astro Docs. Markdown rendering is not different and pretty much everything from the "Markdown in Astro" guide applies to Starlight as well.
Starlight is designed around content collections, and no matter if you follow the "Getting Started" guide or the manual setup, both either comes with content collections configured or makes you configure them as part of the installation process. Personally, I don't think I've ever seen a Starlight project that doesn't use content collections (this makes sense considering it's part of the current initial setup). While we can probably change some of our current assumptions around content collections to avoid some potential errors, just like Starlight components, they're designed to be used in a valid Starlight project and do not aim to work outside of it. Starlight current content collection support is already limited in some ways, e.g. we're limited to a When it comes to |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have some confusion about
<StarlightPage>
, although some docs were introduced in Using Starlight’s design in custom pages, but how to handle different source markdown content is not mentioned; this is a point that needs special attention, especially after the release of astro 5.10, which brought a new API: live content collections.
But let’s go back and sort out the possible situations.
For now, if we render using a collection, we must define a
content.config.ts
file, because Starlight will read this custom docs schema.starlight/packages/starlight/utils/starlight-page.ts
Line 214 in fc6f311
If we direct render some content, don't use a collection, we will not create a
content.config.ts
file, but this will cause a build error:At this point, most people don’t use a collection or customize a docs schema. I think providing a default docs schema is sufficient to initialize
<StarlightPage>
, but I also have a question: don't we know users only use<StarlightPage>
, not use the docs collection?Next, if we adapt the live content, we have to make a change to render markdown at request time rather build time.
This also gives us a chance to support the renderMarkdown API.
Finally, a
<StarlightPage>
with request time render markdown will be an awesome feature. 🚀Beta Was this translation helpful? Give feedback.
All reactions