HolyStitch does not use AI to decide what is a component. Instead, it reads theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/BaselAshraf81/holystitch/llms.txt
Use this file to discover all available pages before exploring further.
<!-- ComponentName --> markers that Google Stitch embeds in every exported HTML file and uses them as the authoritative component boundaries.
How Stitch marks components
When Stitch exports a screen to HTML, it inserts an HTML comment immediately before each component’s root element:Label normalization
Raw comment text is normalized to a valid PascalCase React component name before use. Rules applied in order:- Strip a leading
/(for closing comments like<!-- /ComponentName -->) - Strip connector suffixes:
from ...,for ...,by ...,- ...,– ... - Strip everything from
:onwards —"Entry 1: Latest"becomes"Entry 1" - Convert to PascalCase
- Reject if fewer than 3 characters or does not start with an uppercase letter
Normalization examples
Normalization examples
| Raw comment text | Normalized name |
|---|---|
TopNavBar | TopNavBar |
TopNavBar from JSON mapping | TopNavBar |
Entry 1: Latest | Entry1 |
Bold Footer CTA | BoldFooterCta |
<!-- /HeroSection --> | HeroSection |
ab | (rejected — too short) |
<!-- a list --> | (rejected — starts lowercase) |
Only comments that start with an uppercase letter (after stripping a leading
/) are treated as component markers. Lowercase comments like <!-- TODO --> or <!-- section start --> are ignored.The collectAll recursive algorithm
Component extraction is AST-based, not regex-based. HolyStitch parses the body HTML with htmlparser2 (with character position tracking enabled) and then runs collectAll over the resulting node tree.
<main> or <section> wrapping multiple components) are traversed without being claimed. They remain intact in the page body HTML.
Content threshold
Tiny decorative elements are skipped. An element qualifies as a component only if it meets at least one of:- It has at least one child element (not just text)
- Its outer HTML is at least 300 characters long
Block elements recognized as component roots
A comment marker can only claim an element whose tag name is in the block element set. Inline elements like<span> or <a> are not claimable.
Component tree vs flat list
collectAll produces a flat RawExtraction[] array, but each entry carries depth and parentName fields that encode the tree structure. After deduplication, this is converted into ParsedComponent objects:
depth: 0 with parentName: null are root components — they appear directly in the page file’s return statement. Components at deeper depths are sub-components imported and used by their parent.
Example tree for the HTML above:
HeroSection.tsx imports and renders <HeroCta />. The page file imports TopNavBar, HeroSection, and Footer.
Page body reconstruction
After extracting all root components,buildPageBody reconstructs the page body HTML with root component blocks replaced by <ComponentName /> self-closing tags:
commentStart descending) so that earlier character positions remain valid as the string is modified.
The result for the HTML example above would be:
<main>, for example) are preserved intact. This means the page file keeps the original layout intent from Stitch.
Composed component HTML
Each component’shtml field is built by replacing its direct child component spans with <ChildName /> placeholders, using the same end-to-start replacement strategy. This gives each component a clean JSX composition body:
Cross-screen shared component detection
When the same component name appears on multiple screens, HolyStitch computes Jaccard similarity over word tokens from both HTML strings to determine whether they are the same widget:- ≥ 0.7 similarity — same component; the first screen’s file is reused, subsequent screens skip writing
- < 0.7 similarity — different widget that happens to share a name; a screen-scoped copy is created as
ComponentName + PascalCasedScreenName(e.g.,FooterPricingPage), and a warning is written toproject-context.md
sharedComponents field in ConvertStitchOutput lists every component name that appears on two or more screens (above the similarity threshold).