New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Aside markdown components are not working in markdoc #925
Comments
I am not a Markdoc user so I may be wrong, but I think this is currently the expected behavior. The aside mechanism in Starlight is based on a remark plugin and as far as I know, remark is incompatible with Markdoc's transform pipeline. If I were to imagine a potential solution, I think Markdoc's users would need to edit their import { defineMarkdocConfig, component } from "@astrojs/markdoc/config";
export default defineMarkdocConfig({
tags: {
aside: {
render: component('@astrojs/starlight/markdoc', 'Aside'),
attributes: {
type: { type: String, required: true, matches: ['note', 'tip', 'caution', 'danger'], },
title: { type: String, required: false },
},
},
},
}); If this was a valid setup, at this point users should now be able to use:
Not sure if this is the best solution, but I think it could work but having the opinion of someone more familiar with Markdoc would be great. |
I think that sounds like a great workaround for Markdoc users. |
Yes, I can confirm this is expected as we’re using We haven’t invested much in our Markdoc support yet, but I think in the future the aim would be to have a |
Thanks again for the issue @serkangunes and apologies for not circling back sooner. Starlight now exposes an Here is a small example project which sets this up: https://stackblitz.com/edit/github-upz7sj?file=markdoc.config.mjs See // markdoc.config.mjs
import { defineMarkdocConfig, component } from '@astrojs/markdoc/config';
export default defineMarkdocConfig({
tags: {
aside: {
render: component('@astrojs/starlight/components', 'Aside'),
attributes: {
type: {
type: String,
default: 'note',
matches: ['note', 'tip', 'caution', 'danger'],
},
title: {
type: String,
required: false,
},
},
},
},
}); ---
# src/content/index.mdoc
title: Markdoc Asides example
template: splash
---
{% aside %}
This is a test aside
{% /aside %}
{% aside type="tip" %}
This is an aside with a specified type.
{% /aside %}
{% aside title="Custom Title" %}
This is an aside with a custom title.
{% /aside %} In the future we might look to expose this Markdoc config as a helpful preset, but for now I think this should unlock anyone looking to use asides in their Markdoc documents. |
@delucis Thanks for the update. This is cool. |
What version of
starlight
are you using?0.11.1
What version of
astro
are you using?3.2.3
What package manager are you using?
npm
What operating system are you using?
Mac
What browser are you using?
Chrome
Describe the Bug
Aside components rendered with
:::
blocks are not working in markdoc files.Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-pce8ue?file=src%2Fcontent%2Fdocs%2Findex.mdoc
Participation
The text was updated successfully, but these errors were encountered: