Skip to content

Add LLM-friendly markdown outputs and Copy page menu#132

Merged
sainath-testsigma merged 32 commits into
devfrom
feat/markdown-docs
May 19, 2026
Merged

Add LLM-friendly markdown outputs and Copy page menu#132
sainath-testsigma merged 32 commits into
devfrom
feat/markdown-docs

Conversation

@sainath-testsigma
Copy link
Copy Markdown
Contributor

@sainath-testsigma sainath-testsigma commented May 19, 2026

Summary

Ships the testmu/Mintlify-style LLM surface for testsigma.com/docs/test-management/ (~93 pages) as a pilot. After this lands, the same approach can be ported to testsigma-docs (519 pages).

What changed:

  • Per-page Markdown companions — every doc emits a clean <slug>.md next to its HTML output. Strips frontmatter to a minimal subset (title, metadesc, canonical, page_id), converts [[info]] blocks to blockquotes, replaces Storylane iframes with a labeled link, converts <br> to newlines outside table cells, rewrites stray <a> tags to Markdown, and strips <script> tags.
  • llms.txt index at /docs/test-management/llms.txt — grouped by section, sorted by frontmatter order, links point to .md companions.
  • Hand-authored home .md at /docs/test-management.md for the /docs/test-management/ URL (rendered from index.jsx, so no source .md for the hook to pick up).
  • <link rel="alternate" type="text/markdown"> in every page <head> so LLM tools can discover the companion.
  • S3 Content-Type override (text/markdown; charset=utf-8) for .md files via gatsby-plugin-s3 params.
  • "Copy page" dropdown at the top-right of every doc page (inline with the title) — Copy as Markdown, View as Markdown, Open in ChatGPT / Claude / Perplexity. Uses navigator.clipboard with execCommand fallback; closes on outside click via react-onclickout (already a dep).

Files:

  • gatsby-node.js — extended onPostBuild with the emitter + transformation pipeline + index/home writers (~190 new lines)
  • gatsby-config.jsparams block for gatsby-plugin-s3
  • src/components/seo.jsx<link rel="alternate"> after canonical
  • src/components/CopyPageMenu.jsx + .scss — new dropdown component
  • src/templates/page.jsx — mount <CopyPageMenu> inline with the title

Test plan

  • npm install --legacy-peer-deps && npm run build succeeds; build log shows Emitted 93 .md companions + llms.txt + test-management.md
  • npm run serve and visit any test-management page — "Copy page ▾" renders top-right of the title; all 5 menu items behave
  • Spot-check public/docs/test-management/test-cases/manage-test-cases.md — clean markdown, frontmatter intact, H1 from title
  • Stress-check public/docs/test-management/atto/best-practices/writing-best-prompts.md — tables intact, <br> preserved inside cells
  • Stress-check public/docs/test-management/api-reference/modules.md — all anchor cells converted to [text](url), no stray <a> tags
  • Stress-check public/docs/test-management/settings/custom-fields.md&lt;number&gt; HTML entities preserved
  • After deploy: curl -sI https://<host>/docs/test-management/introduction/overview.md returns Content-Type: text/markdown; charset=utf-8
  • Paste a test-management URL into ChatGPT / Claude — they fetch the .md companion (visible in tool reasoning) and answer cleanly

Summary by CodeRabbit

Release Notes

  • New Features

    • Added "Copy page" menu enabling users to copy documentation as markdown
    • Option to view page markdown in a new tab
    • Integrated quick-share links to ChatGPT, Claude, and Perplexity
    • Added markdown alternate link metadata for improved AI accessibility
  • Chores

    • Enhanced build process to generate markdown companion files for documentation

Review Change Stack

bharathk08 and others added 30 commits July 28, 2025 12:28
* Tms 1532 (#50)

* Updated the title for the Homepage on BreadSchema

* Updated Atto overview page

Fixed incorrect interlinks in the introduction to Atto page

* Added CI/CD & API docs for TMS (#39)

Added CI/CD & API docs for TMS

* Dummy commit

* Fixed Issue With AWS User Access

Fixed Issue With AWS User Access

* Fixed Issue with AWS User Access

* Merge pull request #41 from testsigmahq/TMS-1520

Added Jira Actions Sync Steps & CI/CD docs

* Added Versions for TMS Docs

---------

Co-authored-by: Santhoshkumar <117272529+Santhosh-testsigma@users.noreply.github.com>
Co-authored-by: Abdul <132989679+Abdul-jailani@users.noreply.github.com>
Co-authored-by: Vikram Chaitanya <vikram@testsigma.com>

* Added new docs for Jira two-way integration (#51)

* Added new docs for Jira two-way integration

* Update manage-sprints.md

* Changed app name for Jira integration (#52)

* updated sitemap

---------

Co-authored-by: Santhoshkumar <117272529+Santhosh-testsigma@users.noreply.github.com>
Co-authored-by: Abdul <132989679+Abdul-jailani@users.noreply.github.com>
Co-authored-by: Vikram Chaitanya <vikram@testsigma.com>
* [WEB-1811] - Fixed the CI build failing issue (#56)

* Best Practices docs for Atto (#55)

* Added images for best practices (#57)

* [WEB-1811][Rework] - Updated the Gatsby config (#58)

* trail and error 1 (#59)

* small fix (#60)

* removed gatsby clean (#61)

* [WEB-1812] - Fixed the font issue (#62)

---------

Co-authored-by: Santhoshkumar <117272529+Santhosh-testsigma@users.noreply.github.com>
* Merge pull request #64 from testsigmahq/IDEA-2443

added linear integration & export reports

* Addde Interactive demo for Creating Reports (#65)
New docs for Linear Integration & Export Reports
Added docs for Test Run & Plan public link
[WEB-1924] - Removed the FreshChat chat bot and Integrated the Salesforce Chatbot
* Added Audit Logs for TMS Docs

* fixed few errors
[Dev] - Fixed the SH chatbot logo alignment issue
Added new doc for generating tests from files
Updated Typo in Linear Doc
Dev - Removed the Salesforce chatbot
Dummy commit for Updated typesense key updation
Added docs supporting ClickUp Integration
[Dev] - Removed the Open source note on the Docs footer
Added 'Sprint Planner for ClickUp Tasks'
Added no follow links as per SEO team suggestions
Added new docs for TS <> TMS Integration
Added new docs to TS <> TMS Integration
Added Review & Clone Tests, Comments & Alerts docs
Replaced the redirected URLs to the original URL
Added Datasets, Traceability & Confluence Int docs
Added new Azure DevOps docs (#116)
Added 3 docs for Test Capture
* Uploaded Images to New S3 Bucket & made changes across TMSDocs (#129)

* New Update for Broken Images (#130)
Emit per-page <slug>.md companions, an llms.txt index, and a hand-authored
home .md for /docs/test-management/ during gatsby build. Add
<link rel="alternate" type="text/markdown"> to every page's head, configure
S3 Content-Type for .md, and ship a "Copy page" dropdown next to the page
title with Copy / View / Open in ChatGPT / Claude / Perplexity actions.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 19, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: aed0a88b-4977-4763-b4b5-a60800355fd3

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This PR extends the documentation pipeline to generate LLM-optimized markdown versions of /docs/test-management/ pages. It configures S3 to serve markdown with proper content-type, adds a Gatsby post-build transformation that converts HTML patterns to clean markdown with YAML frontmatter, and provides a UI component for users to copy/share those companions with external AI services.

Changes

LLM-Friendly Markdown Companions

Layer / File(s) Summary
S3 Markdown Content-Type Configuration
gatsby-config.js
S3 plugin configured to serve **/*.md files with Content-Type: text/markdown; charset=utf-8 header.
Gatsby Node: LLM Markdown Generation Pipeline
gatsby-node.js
Async onPostBuild lifecycle expands to scan /docs/test-management/*.md, transform HTML patterns (info blocks, Storylane embeds, anchors, br normalization, script stripping) into LLM-friendly markdown, wrap with YAML frontmatter including canonical URLs, emit cleaned files to public/, and generate an llms.txt index grouped by section metadata.
CopyPageMenu Component
src/components/CopyPageMenu.jsx, src/components/CopyPageMenu.scss
Interactive menu component with SVG icons, clipboard copy logic (Clipboard API + textarea fallback), "Copied!" feedback state, and dropdown menu offering markdown copy, markdown view, and pre-filled prompts for ChatGPT, Claude, and Perplexity. Styles include trigger button with hover/focus states, dropdown panel with aggressive list/link overrides, and external-link icon visibility on hover.
SEO and Page Template Integration
src/components/seo.jsx, src/templates/page.jsx
SEO metadata gains a <link rel="alternate" type="text/markdown"> tag for the companion markdown URL; page header refactored from plain h1 to flex container placing title on left and CopyPageMenu on right.

Sequence Diagrams

flowchart TD
  Input["Source *.md in<br/>src/pages/docs/test-management/"] --> Parse["Parse frontmatter<br/>Check noindex flag"]
  Parse --> Transform["Transform content:<br/>info blocks, Storylane,<br/>anchors, br tags,<br/>scripts"]
  Transform --> Frontmatter["Wrap with YAML<br/>frontmatter"]
  Frontmatter --> Write["Write to public/<br/>under derived slug"]
  Write --> Aggregate["Aggregate metadata<br/>by section"]
  Aggregate --> Index["Generate llms.txt<br/>index"]
  Index --> Home["Write hand-authored<br/>home page"]
Loading
sequenceDiagram
  participant User
  participant Menu as CopyPageMenu
  participant Clipboard as navigator.clipboard
  participant LLM as External LLM
  User->>Menu: Click trigger
  activate Menu
  Menu->>Menu: Toggle open state
  User->>Menu: Click copy markdown
  Menu->>Menu: Fetch markdown from<br/>derived URL
  Menu->>Clipboard: Copy to clipboard
  Clipboard-->>Menu: Success/Fallback
  Menu->>Menu: Show "Copied!" feedback
  User->>Menu: Click external link
  Menu->>LLM: window.open with prompt
  Menu->>Menu: Close menu
  deactivate Menu
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • testsigmahq/TMSDocs#18: Adds new Storylane "Interactive Demo" iframes to /docs/test-management/atto/... content that will be directly processed by the new Storylane-to-markdown transformation logic in this PR's gatsby-node.js.

Suggested reviewers

  • Santhosh-testsigma
  • bharathk08

Poem

🐰 A rabbit's ode to markdown companions!

Markdown flows from HTML's chains,
Companions born for LLM brains,
Copy, share, and let them read—
Docs made free, for every need! 📋✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely summarizes the main changes: adding LLM-friendly markdown outputs and a copy page menu feature.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/markdown-docs

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/components/CopyPageMenu.jsx`:
- Around line 89-90: The mdUrl construction in CopyPageMenu.jsx currently
hardcodes "https://testsigma.com" and calls slug.replace(...) without checking
slug; update mdUrl to derive the origin from window.location.origin (or fallback
to a safe default) and guard slug before calling replace by ensuring slug is a
string (e.g., const safeSlug = typeof slug === 'string' ? slug : ''). Then
compute mdUrl = `${origin}${safeSlug.replace(/\/$/, '')}.md`; update references
to mdUrl and prompt accordingly so you never call replace on undefined and the
URL works in non-production origins.
- Around line 102-113: The temporary-textarea copy path currently ignores the
return value of document.execCommand('copy'), so setCopied(true) is called even
when the copy failed; update the copy logic in the handler (the function that
creates the textarea and calls document.execCommand('copy')) to capture the
boolean result of document.execCommand('copy') and only call setCopied(true)
(and start the timeout) when that result is true (and similarly when using
navigator.clipboard.writeText()); always remove the textarea and handle/fall
back on errors by not setting copied on failure and optionally logging or
rejecting so callers know copy failed.

In `@src/components/seo.jsx`:
- Around line 204-208: The alternate link construction calls replace on slug
directly and will throw if slug is undefined; update the href expression in the
SEO component (the <link rel='alternate' ...> using slug) to ensure slug is a
string before calling replace (e.g., default slug to '' or use (slug ||
'').replace(/\/$/, '') so the template literal becomes
`https://testsigma.com${(slug || '').replace(/\/$/, '')}.md`), ensuring no
runtime crash when slug is absent.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 542e1030-6d3c-412b-bef8-e78491c6b010

📥 Commits

Reviewing files that changed from the base of the PR and between 1623794 and 02ddbff.

📒 Files selected for processing (6)
  • gatsby-config.js
  • gatsby-node.js
  • src/components/CopyPageMenu.jsx
  • src/components/CopyPageMenu.scss
  • src/components/seo.jsx
  • src/templates/page.jsx

Comment thread src/components/CopyPageMenu.jsx Outdated
Comment thread src/components/CopyPageMenu.jsx
Comment thread src/components/seo.jsx
@sainath-testsigma sainath-testsigma changed the base branch from main to dev May 19, 2026 04:52
CopyPageMenu: coerce non-string slug to '' and read window.location.origin
(with prod URL fallback for SSR) so the .md URL works in local dev and
staging without hardcoding a production host.

seo.jsx: default slug to '' in the alternate link href so the SEO render
won't crash if a future caller forgets to pass slug.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@sainath-testsigma sainath-testsigma merged commit 9ee5d05 into dev May 19, 2026
2 checks passed
@sainath-testsigma sainath-testsigma deleted the feat/markdown-docs branch May 19, 2026 05:07
@coderabbitai coderabbitai Bot mentioned this pull request May 19, 2026
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.

4 participants