ui icon indicating copy to clipboard operation
ui copied to clipboard

Docs: Add "Copy Page as Markdown" Button to Nuxt UI v3 Documentation

Open Mat4m0 opened this issue 9 months ago • 2 comments

Description

Feature Request: Add "Copy Page as Markdown" Button to Nuxt UI v3 Documentation

Description: Add a button to each component documentation page that allows users to copy the current page content in markdown format.

Problem:

  • The full documentation text at ui.nuxt.com/llms-full.txt contains too much information when I only need documentation for specific components
  • GitHub raw files don't show the dynamic content visible on the actual documentation site
  • Need an easy way to copy specific component documentation for use in prompts to AI assistants

Proposed Solution: Add a "Copy Page as Markdown" button to each documentation page, similar to the implementation on https://modelcontextprotocol.io/introduction

User Benefit: This feature would let users easily copy specific component documentation to paste as additional context in AI prompts, improving the relevance and focus of AI assistance for Nuxt UI development.

Additional context

No response

Mat4m0 avatar Apr 17 '25 13:04 Mat4m0

@Mat4m0 I've already thought about it, and I think it would be a good addition personally, but it would clearly be something that would even be beneficial directly in the nuxt-llms module. Having an option to also generate a file per page! @farnabaz, is this something that could be considered and not too complex to implement 🤔

HugoRCD avatar Apr 17 '25 14:04 HugoRCD

I wrote a script to split out the markdown from the llms_full.txt. It will split the markdown into each individual component in the same directory. Working great for my use case, hopefully this can help others.

https://gist.github.com/phillycheeze/bdcda5ff9c44a470bf0f49c1edfc3684

phillycheeze avatar Apr 25 '25 14:04 phillycheeze

Thank you so much @phillycheeze you inspired me to do it in Bun as well.

// bun generate-nuxt-ui-docs.ts
const res = await fetch("https://ui.nuxt.com/llms-full.txt");
const txt = await res.text();

let start = 0;
let end = txt.indexOf("\n# ");

do {
  const page = txt.slice(start, end);
  const filename = page.slice(2, page.indexOf("\n"));
  console.log(`Writing ${filename}.md`);
  await Bun.write(`./nuxt-ui-docs/${filename}.md`, page);

  start = end + 1;
  end = txt.indexOf("\n# ", start);
} while (end !== -1);

Gist: https://gist.github.com/carlos-duran/5ad68c5255fe196ed57288f227166446

carlos-duran avatar May 04 '25 18:05 carlos-duran