Skip to content

Fix component defined in extends not rendered as Markdoc tags/nodes#11846

Merged
ematipico merged 1 commit intowithastro:mainfrom
HiDeoo:hd-fix-markdoc-extends-components
Aug 27, 2024
Merged

Fix component defined in extends not rendered as Markdoc tags/nodes#11846
ematipico merged 1 commit intowithastro:mainfrom
HiDeoo:hd-fix-markdoc-extends-components

Conversation

@HiDeoo
Copy link
Copy Markdown
Member

@HiDeoo HiDeoo commented Aug 27, 2024

Changes

This PR fixes an issue where rendering Astro components as Markdoc tags and nodes when configured using the extends property would lead to an error (Unable to render [object Object]. No valid renderer was found for this file extension.).

This would prevent for example Starlight users to have a configuration like this:

export default defineMarkdocConfig({
  extends: [starlightMarkdoc()]
  tags: {
    custom: { render: component('./src/components/Custom.astro') },
  },
});

The issue was that when creating the component configs for used tags and nodes, the user-defined Markdoc config was used instead of the computed one that also contains the merged configurations from the extends property.

Testing

I mostly duplicated the existing test/fixtures/render-with-components fixture and its associated test/render-components.test.js tests and created a fixture where the configuration is done using extends.

Docs

This is a bug fix for a feature that does not have a specific documentation or example.

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Aug 27, 2024

🦋 Changeset detected

Latest commit: 0bab683

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added the pkg: integration Related to any renderer integration (scope) label Aug 27, 2024
Copy link
Copy Markdown
Member

@ematipico ematipico left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@ematipico ematipico merged commit ed7bbd9 into withastro:main Aug 27, 2024
@astrobot-houston astrobot-houston mentioned this pull request Aug 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg: integration Related to any renderer integration (scope)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants