Skip to content
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

[[email protected]] top level custom markdoc tags are not rendered when rootHtml is null #12964

Open
1 task
ayZagen opened this issue Jan 10, 2025 · 1 comment · May be fixed by #12967
Open
1 task

[[email protected]] top level custom markdoc tags are not rendered when rootHtml is null #12964

ayZagen opened this issue Jan 10, 2025 · 1 comment · May be fixed by #12967
Assignees
Labels
- P4: important Violate documented behavior or significantly impacts performance (priority) pkg: markdoc Related to the `@astrojs/markdoc` package (scope)

Comments

@ayZagen
Copy link

ayZagen commented Jan 10, 2025

Astro Info

Astro                    v5.1.5
Node                     v18.20.3
System                   Linux (x64)
Package Manager          unknown
Output                   static
Adapter                  none
Integrations             @astrojs/markdoc

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

This issue happens after upgrading @astrojs/markdoc to 0.12.5.

When we set the rootHtml to null like in documentation custom markdoc tags are not rendered when encountered in top level.

//markdoc.config.js
import { defineMarkdocConfig, nodes, component } from '@astrojs/markdoc/config';
export default defineMarkdocConfig({
  nodes: {
    document: { ...nodes.document, render: null },
  },
  tags: {
    grid: {
      render: component('./src/components/Grid.astro'),
      attributes: {
        classes: { type: String },
      },
    },
  },
});

If you remove nodes.document setting or wrap the tag with another element it works. I have included both cases in reproduction.

Rendered output example:
image

What's the expected result?

It should render correctly. No problems with 0.12.4

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-kq641b?file=src%2Fcontent%2Fdocs%2Fintro.mdoc

Participation

  • I am willing to submit a pull request for this issue.
@github-actions github-actions bot added the needs triage Issue needs to be triaged label Jan 10, 2025
@ayZagen
Copy link
Author

ayZagen commented Jan 10, 2025

I didn't notice at first but custom nodes are not rendered too.

For example:

 nodes: {
    document: {...nodes.document, render: null as any} ,
    heading: {
      ...nodes.heading,
      render: component('./src/components/content/CustomHeading.astro'),
    },
 }

@ayZagen ayZagen changed the title [Markdoc] top level custom markdoc tags are not rendered when rootHtml is null [[email protected]] top level custom markdoc tags are not rendered when rootHtml is null Jan 10, 2025
@bluwy bluwy added - P4: important Violate documented behavior or significantly impacts performance (priority) pkg: markdoc Related to the `@astrojs/markdoc` package (scope) and removed needs triage Issue needs to be triaged labels Jan 10, 2025
@bluwy bluwy self-assigned this Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P4: important Violate documented behavior or significantly impacts performance (priority) pkg: markdoc Related to the `@astrojs/markdoc` package (scope)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants