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

include external sourced files into build #3672

Closed
vanbasten17 opened this issue Nov 2, 2020 · 6 comments
Closed

include external sourced files into build #3672

vanbasten17 opened this issue Nov 2, 2020 · 6 comments
Labels
feature This is not a bug or issue with Docusausus, per se. It is a feature request for the future.

Comments

@vanbasten17
Copy link
Contributor

🚀 Feature

Be able to pull plain text information from external sources and build it up with docusaurus build.

Example: Retrieving an external markdown file to be injected into a specific route.

Have you read the Contributing Guidelines on issues?

Yes

Motivation

We would like to source github's READMEs and build them with docusaurus build for our project documentation (botonic).
I have seen a related issue here: #2725 , but couldn't find the mentioned plugin in docusaurus docs.

Pitch

I think it's pretty common for open-source projects to have several plugins in order to add extra functionalities to them. In our situation, every plugin is documented itself in its corresponding README in github which serves as the main documentation as for example Gatsby does with their plugins, so this is the main reason of being implemented. This is our current plugins library.
To do so, maybe it would be useful to have a list of urls (pointing to an url with the corresponding .md in this case) and mapping them into desired routes in the project.

Many thanks! 😊 You have an awesome ongoing project!

@vanbasten17 vanbasten17 added feature This is not a bug or issue with Docusausus, per se. It is a feature request for the future. status: needs triage This issue has not been triaged by maintainers labels Nov 2, 2020
@slorber slorber removed the status: needs triage This issue has not been triaged by maintainers label Nov 2, 2020
@slorber
Copy link
Collaborator

slorber commented Nov 2, 2020

Hi, this is something I'd like to support.

However, keep in mind that Github README is commonmark, and we are using MDX. The implementation diverge on the HTML elements, so you'll have to avoid using such elements if you want the readme file to work in both Docusaurus and Github pages.

Unfortunately, for now MDX is not 100% compatible with commonmark (mdx-js/mdx#1125), but it'd like to make it easier to use a commonmark compatible mode, in particular for these usecases (related to #3009 as well)

@slorber
Copy link
Collaborator

slorber commented Nov 2, 2020

BTW, you can already create a docusaurus plugin that creates one page per plugins you have in the monorepo, using a commonmark compatible parser, but you'll have to implement this yourself with plugin lifecycles.

My comment above is mostly if you want to use package READMEs as a part of the docs plugin, have a sidebar, versioning features etc... so it really depends on your need.

@vanbasten17
Copy link
Contributor Author

Hi @slorber , thanks for your time! Would you mind sharing with me some guidelines to create a plugin to support this? I'll try to do this if I can invest some time. Thanks

@slorber
Copy link
Collaborator

slorber commented Nov 3, 2020

@vanbasten17 the best is to read the docs (https://v2.docusaurus.io/docs/lifecycle-apis/), understand the lifecycles to read FS data, create pages etc...
To get some inspiration, the pages plugin is likely easier to understand.

But you'll have to figure out how to replace MDX by a regular MD parser/renderer. It's not something I ever did so I can't really help you more than that.

@Josh-Cena
Copy link
Collaborator

You can now import external MD files: https://github.com/facebook/docusaurus/blob/main/website/community/5-changelog.md

@benlongo
Copy link

benlongo commented May 2, 2022

Unfortunately that link appears to be dead now. I was able to find it here https://github.com/facebook/docusaurus/blob/v2.0.0-beta.15/website/community/5-changelog.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature This is not a bug or issue with Docusausus, per se. It is a feature request for the future.
Projects
None yet
Development

No branches or pull requests

4 participants