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

Issues with Markdoc #6829

Closed
louiss0 opened this issue Apr 12, 2023 · 6 comments
Closed

Issues with Markdoc #6829

louiss0 opened this issue Apr 12, 2023 · 6 comments

Comments

@louiss0
Copy link
Contributor

louiss0 commented Apr 12, 2023

What version of astro are you using?

2.2.1

Are you using an SSR adapter? If so, which one?

None

What package manager are you using?

pnpm

What operating system are you using?

Windows

What browser are you using?

Chrome

Describe the Bug

There are a few problems with Mardoc. I decided to test it and see if things were going to be ok. But I have found a few problems with it

  • Functions can't be used I get an error called invalid child when I attempt to use a function
  • Syntax highlighting is not automatically enabled
  • Code Comments are added to each page.

To see the first two problems go to the markdown-style-guide.mdoc page.
I created the Code component with the fence so that it could just be implemented later on. Other than that I will write a discussion soon.

Link to Minimal Reproducible Example

https://stackblitz.com/edit/withastro-astro-zdtvav

Participation

  • [] I am willing to submit a pull request for this issue.
@louiss0
Copy link
Contributor Author

louiss0 commented Apr 13, 2023

I have recently discovered that markdoc wraps each page in an article tag I hope this is not the way this integration will work in the near future. This is where I discovered it from here. This is another problem.

@louiss0
Copy link
Contributor Author

louiss0 commented Apr 13, 2023

I have a new error now. I have recently found out that camel case string is not parsed in the template when using Markdoc.

Here is the repo where I discovered this bug You'll see it immediately.

@louiss0
Copy link
Contributor Author

louiss0 commented Apr 13, 2023

I recently found out that Markdoc Errors are not displayed because of the Astro Markdoc Implementatiion. I tried to talk to them about error messages but instead I was told this.

Can you tell me how you are performing the validation? It seems like you are just seeing the error id, but Markdoc itself provides very explicit messages. For example, an invalid type shows the message "Attribute '${key}' must be type of '${t}" and an error on a matches rule shows the message "Attribute '${key}' must match one of ${matches}".
Ryan Paul Maintainer of Stripe

I think there is a way of transferring errors from one catcher to another. I think you decided to override the Markdoc errors with your own one.

@paulrudy
Copy link
Contributor

I have recently discovered that markdoc wraps each page in an article tag I hope this is not the way this integration will work in the near future. This is where I discovered it from here. This is another problem.

The solution to this issue is included in this comment in the issue that you linked. Markdoc by default wraps content in <article>...</article>. On markdoc's github, they suggested an undocumented method of avoiding that wrapping. I made an issue that has since been closed, and now that method works fine in Astro.

@louiss0
Copy link
Contributor Author

louiss0 commented Apr 17, 2023

I recently found out that Markdoc Errors are not displayed because of the Astro Markdoc Implementatiion. I tried to talk to them about error messages but instead I was told this.

Can you tell me how you are performing the validation? It seems like you are just seeing the error id, but Markdoc itself provides very explicit messages. For example, an invalid type shows the message "Attribute '${key}' must be type of '${t}" and an error on a matches rule shows the message "Attribute '${key}' must match one of ${matches}".
Ryan Paul Maintainer of Stripe

I think there is a way of transferring errors from one catcher to another. I think you decided to override the Markdoc errors with your own one.

This is better explaned in #6865

@matthewp
Copy link
Contributor

Can you create 1 issue per bug report? It's hard to investigate many things at once. Scanning this issue, for example, I can't tell what is a bug in Astro's Markdoc integration and what is just how Markdoc works. I suspect the error catching is probably a bug on our end, for example. Please create an issue just about that.

Closing to keep the repo to actionable issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants