Skip to content

Support markdown for docs and guides #12924

Open
aliabd wants to merge 14 commits intomainfrom
docs-in-markdown
Open

Support markdown for docs and guides #12924
aliabd wants to merge 14 commits intomainfrom
docs-in-markdown

Conversation

@aliabd
Copy link
Collaborator

@aliabd aliabd commented Feb 23, 2026

Was slightly more complicated than i anticipated.

This adds support for crawling the website in markdown! The way it works is that it intercepts the request and checks if the user agent is an llm crawler. If it is then:

  • for the guides we just return the content (which is written in markdown anyway)
  • for the docs, we use the svx to markdown converter which relies on the AST from mdsvex as well as a ton of regex to parse the content. Does things like converting the paramtable svelte to a markdown table (kept having issues where the | pipe in the types was breaking the table lol). I mostly used claude here to get it to work correctly.

Also added a copy page button and open in huggingchat to the docs pages just like the one we had in guides. You can use it to quickly test if the markdown is correct for the page.

Will continue to test this and make sure everything looks good

Screenshot 2026-02-23 at 9 10 12 PM

Closes: #12586

@gradio-pr-bot
Copy link
Collaborator

gradio-pr-bot commented Feb 23, 2026

🪼 branch checks and previews

Name Status URL
Spaces ready! Spaces preview
Website ready! Website preview
Storybook ready! Storybook preview
🦄 Changes detected! Details

Install Gradio from this PR

pip install https://gradio-pypi-previews.s3.amazonaws.com/76f9bdc411e82def1da0ca8f0db39998e0be2103/gradio-6.9.0-py3-none-any.whl

Install Gradio Python Client from this PR

pip install "gradio-client @ git+https://github.com/gradio-app/gradio@76f9bdc411e82def1da0ca8f0db39998e0be2103#subdirectory=client/python"

Install Gradio JS Client from this PR

npm install https://gradio-npm-previews.s3.amazonaws.com/76f9bdc411e82def1da0ca8f0db39998e0be2103/gradio-client-2.1.0.tgz

@gradio-pr-bot
Copy link
Collaborator

gradio-pr-bot commented Feb 23, 2026

🦄 change detected

This Pull Request includes changes to the following packages.

Package Version
website minor

  • Support markdown for docs and guides

✅ Changeset approved by @aliabd

  • Maintainers can remove approval by unchecking this checkbox.

Something isn't right?

  • Maintainers can change the version label to modify the version bump.
  • If the bot has failed to detect any changes, or if this pull request needs to update multiple packages to different versions or requires a more comprehensive changelog entry, maintainers can update the changelog file directly.

Copy link
Collaborator

@freddyaboulton freddyaboulton left a comment

Choose a reason for hiding this comment

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

Thanks @aliabd ! This is going to be super useful. I'm getting empty markdown for both Interface and gr.DateTime components though. I made sure I was on the main branch of the docs:

Image

Image

@aliabd aliabd marked this pull request as draft February 23, 2026 21:56
@aliabd aliabd marked this pull request as ready for review March 9, 2026 05:09
@aliabd
Copy link
Collaborator Author

aliabd commented Mar 9, 2026

@freddyaboulton i made a bunch of fixes and you shouldn't be seeing that issue anymore. Also figured out how to do content negotiation using cloudflare functions, while keeping the site static and now everything is working as expected!

here's an example with claude code:

gradio.app
Screenshot 2026-03-09 at 9 05 12 AM

preview website
Screenshot 2026-03-09 at 9 08 02 AM

to test out what the markdown for a page looks like easiest way is just the copy button. but to test out the content negotiation easiest way is curl

curl -H "Accept: text/markdown" https://ca4021be.gradio-website.pages.dev/docs/gradio/audio

@freddyaboulton
Copy link
Collaborator

This is awesome @aliabd ! The conversion works seamlessly but I found some issues with the conversion function:

Tips are rendered as html

image

<gradio-app> tags are included in the markdown

image

`<class 'inspect._empty'> in chatbot docs.

Weird type present in chatbot markdown docs but it may be an issue with docs generation itself because I see the same thing in html actually

image

@freddyaboulton
Copy link
Collaborator

I would say the "" issue is the only blocker here

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.

Support markdown for all docs and guides pages

3 participants