Skip to content

Copy button and markdown docs feature#612

Open
georgephillips wants to merge 3 commits intomainfrom
markdown-docs
Open

Copy button and markdown docs feature#612
georgephillips wants to merge 3 commits intomainfrom
markdown-docs

Conversation

@georgephillips
Copy link
Contributor

This pull request introduces a standardized toMarkdown export for many UI components, enabling each to serialize itself into Markdown format. This provides a foundation for rendering or exporting documentation content as clean Markdown, and ensures consistent Markdown output across various custom components. The changes also include the addition of a new CopyPageDropdown component, which allows users to copy the current page as Markdown, URL, or a prompt-ready format for LLMs.

Markdown serialization support for components:

  • Added toMarkdown functions to most components in the _components directory, each returning a Markdown representation of the component's content or an empty string if not applicable. This includes components such as Annotation, CodeBlock, CodeTab, CommonParam, DataReference, DataReferenceRow, DocShot, DocsImage, DocsVideo, Example, GlossaryTerm, GuideGrid, ImageWrapper, InteractiveTree, and LanguageIcon. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15]

  • Updated MultiCodeBlock.tsx to re-export the toMarkdown function from CodeBlock.tsx for consistency and backward compatibility.

New feature: CopyPageDropdown component

  • Introduced a new CopyPageDropdown component, which provides a UI for copying the current page as Markdown, as a URL, or as a context-wrapped prompt for LLMs. The component fetches the Markdown source of the page and supports user feedback via a toast notification.

Minor type and prop improvements:

  • Fixed the GlossaryTermProps type to allow children to be of type unknown, aligning with the usage in other components.

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