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
Replacing Existing Node with Next.js Fails to Pass Attributes #63
Comments
It appears the solution is to map to the render function via the component name which appears to need to be in I'm not sure of the purpose of the render property on the schema in this case, not sure if this is a bug or just an area of duplication in the API. I also discovered that the I think both the Below is a working example.
|
More context on this answer here: #64 If you want to use a custom React component, we recommend creating a However, if you just want to transform your headings (to, for example, always have an ID), then you can use the This is demonstrative of the fact that in React, |
@arranf the level property should not be being swallowed… it is working for us here: https://github.com/markdoc/docs/blob/main/markdoc/nodes/heading.markdoc.js#L25 Can you share a reproduction of this? |
To confirm my understanding can you please answer the following?
I think my source of confusion was threefold:
I'll go ahead and create one. |
Repro is here: https://github.com/arranf/markdoc-nextjs-repro |
@arranf you just have a typo, |
🙃 🤡 Well I feel stupid now! Thanks! |
What happened?
Following the docs on nodes and next js nodes is confusing.
Goal: replace the default heading node as the nodes doc demonstrates.
Following the examples in the nodes seems to lead to either the render function being called with no props other than children, or only the transform step being called and not the render step.
Suggestion
Provide more details on the way the nextjs integration interacts with the described transform and render steps, and provide more complete examples for nextjs.
To reproduce
This does render the component however it is never passed any value for level other than the default.
Attempt #2 Try the following
This does allow for multi-level headings however the render function is never called (no log lines printed or component rendered).
Version
@markdoc/markdoc": 0.1.2, @markdoc/next.js: 0.1.4
Additional context
No response
The text was updated successfully, but these errors were encountered: