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

Render Sphinx /docs in docusaurus #2077

Merged
merged 41 commits into from
Feb 16, 2024

Conversation

jaimergp
Copy link
Member

@jaimergp jaimergp commented Feb 13, 2024

PR Checklist:

  • note any issues closed by this PR with closing keywords
  • put any other relevant information below

  • Part of Redesigning conda-forge.org #1971.
  • Move org files from sphinx to community/orgs #2066 and Move meeting minutes to community/meeting-minutes #2068 should probably go in before this one.
  • Based on [DNM] DEMO: how site would look like with current docs Quansight-Labs/cf-infra-docs#14.
  • How it works:
    • This uses a fork of sphinx-markdown-builder that adds better Docusaurus support (e.g. admonitions) to render the Sphinx docs to markdown documents.
    • The rendered Markdown has resolved all the references and Sphinx directives to regular Markdown Docusaurus can understand.
    • These MD documents are moved to /docs by a special script that also handles some minor postprocessing (adding sidebar_position, rewriting some URLs, etc).
    • From there, Docusaurus will take /docs as if they were written by hand and publish the site.
  • The default URL structure is a bit different in docusaurus. Directory names like /path/thing/ are preferred to file names like /path/thing.html. Our Sphinx site also had strange 00_intro.html instead of index.html. To that effect, we have added redirects from /path/to/thing.html -> /path/to/thing/ and /path/00_intro.html -> /path/.
  • Since we have now all the site rendered under Docusaurus, we can add some plugins:
    • Algolia search for super awesome search results. These should become available once we merge. It should look like the search bar in conda.org. If we don't want Algolia, we can use lunr (local search, JS plugin, not as powerful).
    • GoatCounter for OSS-friendly stats, no cookies

Notes for reviewers:

  • We have PR previews now! Check how the new docs look like at https://deploy-preview-2077--conda-forge-previews.netlify.app/docs/.
  • There might be minor formatting issues so hopefully we catch those during the review. Screenshots or links in the preview would be super helpful!
  • Yes, the sphinx-markdown-builder fork situation is a bit fragile. We can try to upstream things but: (1) some things are Docusaurus specific and might need options; (2) this is supposed to be temporary to some degree, because ideally we would end up writing everything in native Docusaurus 🤞. If (2) doesn't happen, then yes, upstreaming is even more important.

@jaimergp jaimergp requested a review from a team as a code owner February 13, 2024 18:56
Copy link

netlify bot commented Feb 13, 2024

Deploy Preview for conda-forge-previews ready!

Name Link
🔨 Latest commit bc6667a
🔍 Latest deploy log https://app.netlify.com/sites/conda-forge-previews/deploys/65cf34961625f3000872c176
😎 Deploy Preview https://deploy-preview-2077--conda-forge-previews.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 configuration.

@jaimergp jaimergp changed the title Render in docusaurus Render Sphinx /docs in docusaurus Feb 13, 2024
yaml = YAML(typ="safe")
yaml.default_flow_style = False

SIDEBAR_ORDERING = [
Copy link
Member

Choose a reason for hiding this comment

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

If we change the website's high-level structure, does that mean this list will need to change too? If yes, we should add a comment and maybe have some sort of CI check.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch! Added a check to raise if the document is not found in this list. Hopefully, if we start changing sphinx/ stuff, is to bring it over to Docusaurus, so "this should not happen" but better be safe than sorry.

Copy link
Member

@beckermr beckermr left a comment

Choose a reason for hiding this comment

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

LGTM from me but I left a few comments.

@beckermr
Copy link
Member

Well I tried to fix the core and emeritus member lists @jaimergp but I think I am missing something important about how sphinx is working now or I got the relative path wrong.

sphinx/src/conf.py Outdated Show resolved Hide resolved
sphinx/src/conf.py Outdated Show resolved Hide resolved
@jaimergp
Copy link
Member Author

Let me take a look, you mean the governance.rst substitution, right?

@jaimergp
Copy link
Member Author

Ok, the early return branch made us skip that part because the rendered is not HTML anymore, but Markdown. I adjusted a couple things and also added the CFEP substitution there because it's cleaner (otherwise you might risk accidentally committing the rendered version, like it happened two days ago :D).

@jaimergp
Copy link
Member Author

@beckermr
Copy link
Member

Awesome. This last thing was the only comment on slack. I'd say lgtm and let's merge this. Any other issues can be fixed later.

@jaimergp
Copy link
Member Author

Yes, I can take a look on the search bar too. Hopefully it starts working once we merge. I don't see any difference with conda.org's setup.

@jaimergp jaimergp merged commit 5040828 into conda-forge:main Feb 16, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants