docusaurus-openapi icon indicating copy to clipboard operation
docusaurus-openapi copied to clipboard

Support for loading custom Markdown files

Open danieleds opened this issue 3 years ago • 7 comments

This PR adds the following features:

  • support for loading arbitrary markdown files from the file system tree
  • support for _spec_.{yaml,yml,json} files, which do not generate a new category
  • support for sorting categories and items in the sidebar using _category_ or front matter in custom mdx files

Solves:

  • https://github.com/cloud-annotations/docusaurus-openapi/issues/135
  • https://github.com/cloud-annotations/docusaurus-openapi/issues/136
  • https://github.com/cloud-annotations/docusaurus-openapi/issues/137 (using _spec_, but we can change this)

Example

File tree (notice examples/custom-overview.md, examples/petstore/_spec_.yaml, examples/petstore/my-intro.md):

Screenshot 2022-07-11 at 18 21 35

Results:

Screenshot 2022-07-11 at 18 20 45 Screenshot 2022-07-11 at 18 20 52

@bourdakos1 I would love your review on this.

There are a lot of changes in the diff, but most of the stuff (the one in packages/docusaurus-plugin-openapi/src/docs/) has been taken and "tree-shaked" from the original plugin-content-docs plugin (they don't export those functions, unfortunately).

danieleds avatar Jul 11 '22 16:07 danieleds

Deploy Preview for docusaurus-openapi ready!

Name Link
Latest commit 4c1ab36c4e2f128f3f45f5e54896265087813207
Latest deploy log https://app.netlify.com/sites/docusaurus-openapi/deploys/62e8e536d04ee8000800ada0
Deploy Preview https://deploy-preview-193--docusaurus-openapi.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

netlify[bot] avatar Jul 11 '22 16:07 netlify[bot]

Is this ready for review?

bourdakos1 avatar Jul 15 '22 14:07 bourdakos1

@bourdakos1 It is ready, I am just making some minor linting fixes

danieleds avatar Jul 15 '22 14:07 danieleds

It will probably take me a few days to review this, but I’m excited for the update 😁

bourdakos1 avatar Jul 17 '22 02:07 bourdakos1

fixed a bug where the slug property wasn't properly recognized

danieleds avatar Jul 29 '22 15:07 danieleds

The "My Custom Petstore" / "My Intro" page doesn't load for me

bourdakos1 avatar Aug 02 '22 02:08 bourdakos1

My bad, I forgot to push stuff. Could you try it again?

danieleds avatar Aug 02 '22 08:08 danieleds

Great feature! Do you have plans to release a new version of the package on npm? I'm interested using this feature too :)

Thank you!

joanjane avatar Sep 21 '22 07:09 joanjane