Custom types for asides #2068
Replies: 4 comments 2 replies
-
Thanks for the idea @essential-randomness! I guess this is specifically about adding extra directives. Asides currently have a couple of components:
So I guess a feature like this would need that too and assumes people want customisation but not much customisation (because basically the asides would still have the same format). The alternative might be a generic Astro integration which maps remark directives to whatever user-defined components you provide. Then that doesn’t need to be built into Starlight and gives more flexibility. Was chatting about that with @OliverSpeir the other day.
The other types all come with translations for their default labels, so presumably this should work the same somehow. Definitely a tricky aspect about designing an API to support this! |
Beta Was this translation helpful? Give feedback.
-
Yeah allowing custom components Having the current remark component accept more props would be cool too like a background color and icon etc so you can customize on the fly as well |
Beta Was this translation helpful? Give feedback.
-
For the default label, one could use the name of the aside type (e.g. "question" or " For colors, what docusaurus did was adding a class to the aside which was the name of the new type. This allows people to override styling with their own custom ones. I don't know what your custom styling for asides is like, but I assume any would be fine. "Customizing but not too much" is the idea here. I wouldn't want to define a new component from scratch. The idea of custom directives is interesting, but for this specific issue only if I could still reuse Starlight's Aside somehow. I don't really want to create a new Aside component and have it clutter my components folder, or keep it up to date with how Starlights's look like. With that said, I do think it's an interesting idea, and I might consider helping according to how much work it is :P |
Beta Was this translation helpful? Give feedback.
-
I would personally much prefer just extending the current Astro component to allow further customization. The DX of complex markdown directives were always way over-complicated imo. |
Beta Was this translation helpful? Give feedback.
-
What version of
starlight
are you using?0.24.4
What is your idea?
As the title says, allow adding custom types for asides. This is possible in Docusaurus (which uses a similar syntax for asides) by using configuration options, but it's not possible in Starlight.
Looking at the code of the remark plugin, this should be as simple as adding an additional configuration options with a list of aside types and icons. My only doubt is how this would work with i18n, which I've never used with Starlight, though I don't think the other types are localized either.
Why is this feature necessary?
In our guides, we use different types of callout that are not matched by Starlight's defaults. For example, we differentiate between a "tip" and a "question". We also have "action" asides for extra actions the reader is supposed to take when following along an exercise.
Do you have examples of this feature in other projects?
Here's the feature's documentation in Docusaurus
Participation
Beta Was this translation helpful? Give feedback.
All reactions