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

Add comments to generated files indicating they were generated #1512

Merged
merged 11 commits into from
Mar 3, 2025

Conversation

amikofalvy
Copy link
Contributor

Originally, we had discussed using MDX style comments, but I had done some reading on frontmatter and it wasn't clear if the all frontmatter parsers would support adding a MDX style comment (or anything) above the frontmatter declaration in the mdx file.

{/* This file was auto-generated by Fuma Docs. */ }
---
title: Events
description: Special events hosted by the Museum
full: true
_openapi:
  toc:
  ...

So instead, I opted for YAML style comments within the frontmatter section.

---
# This file was auto-generated by Fuma Docs.
# Do not edit this file directly. Any changes should be made by running the generation command again.
title: Events
description: Special events hosted by the Museum
full: true
_openapi:
  toc:
  ...

One good thing about the YAML style comment is that it is less verbose syntactically and doesn't involve as many special characters required to escape the comment area.

If you disagree with the decision to use YAML style, I can re-implement in the MDX style comment and resubmit the PR.

Copy link

changeset-bot bot commented Mar 2, 2025

🦋 Changeset detected

Latest commit: 6f563e3

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

This PR includes changesets to release 1 package
Name Type
fumadocs-openapi Minor

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

Copy link

vercel bot commented Mar 2, 2025

@amikofalvy is attempting to deploy a commit to the Fuma Team on Vercel.

A member of the Team first needs to authorize it.

@fuma-nama
Copy link
Owner

Can we put it at content body (below the frontmatter)?

@amikofalvy
Copy link
Contributor Author

amikofalvy commented Mar 2, 2025

I've updated the PR to use the MDX style comment format and positioned it beneath the frontmatter section.

Example indicating positioning follows:

---
title: Events
description: Special events hosted by the Museum
full: true
_openapi:
 toc:
---
{/* This file was auto-generated by Fuma Docs. */ }
 ...


This content is added as MDX comments below the frontmatter:

{/* prettier-ignore-start */}
Copy link
Contributor Author

@amikofalvy amikofalvy Mar 2, 2025

Choose a reason for hiding this comment

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

This is required otherwise the example comment gets reformatted (via prettier) as

{/_ This file was auto-generated by Fuma Docs.
Do not edit this file directly. Any changes should be made by running the generation command again. _/}

and it renders with the underscores which is incorrect.

@fuma-nama fuma-nama merged commit 70d715d into fuma-nama:dev Mar 3, 2025
0 of 2 checks passed
@fuma-nama
Copy link
Owner

Thanks for contributing!

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

Successfully merging this pull request may close these issues.

2 participants