{"record":{"id":"8ce4b103e9dc0f1a","repo":"saadeghi/daisyui","slug":"no-fenced-html-example-found-in-filepath","errorCode":null,"errorMessage":"No fenced HTML example found in ${filePath}","messagePattern":"No fenced HTML example found in (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/tailwind-play-share/pr-preview.mjs","lineNumber":433,"sourceCode":"\nfunction readFileAtRevision(revision, filePath) {\n  return git([\"show\", `${revision}:${filePath}`])\n}\n\nfunction listDocsPages(revision) {\n  return git([\"ls-tree\", \"-r\", \"--name-only\", \"-z\", revision, \"--\", docsRoot])\n    .split(\"\\0\")\n    .filter((filePath) => filePath.endsWith(\"/+page.md\"))\n    .sort()\n}\n\nexport function sourceCssFilename(markdown) {\n  return markdown.match(/^source:\\s+\\S*\\/([^/\\s]+\\.css)\\s*$/m)?.[1]\n}\n\nexport function extractFirstHtmlExample(markdown, filePath = \"component page\") {\n  const match = markdown.match(/^[ \\t]*```html[ \\t]*\\r?\\n([\\s\\S]*?)^[ \\t]*```[ \\t]*$/m)\n  if (!match) throw new Error(`No fenced HTML example found in ${filePath}`)\n  return match[1].replaceAll(\"$$\", \"\").trim()\n}\n\nexport function indexDocsPages(pages) {\n  const index = new Map()\n  for (const { filePath, markdown } of pages) {\n    const cssFilename = sourceCssFilename(markdown)\n    if (!cssFilename) continue\n    const mappedPages = index.get(cssFilename) ?? []\n    mappedPages.push({ filePath, markdown })\n    index.set(cssFilename, mappedPages)\n  }\n  return index\n}\n\nfunction buildDocsIndex(revision) {\n  return indexDocsPages(\n    listDocsPages(revision).map((filePath) => ({","sourceCodeStart":415,"sourceCodeEnd":451,"githubUrl":"https://github.com/saadeghi/daisyui/blob/42b09e637e09467aa54a813a5aea53c1179aec75/packages/tailwind-play-share/pr-preview.mjs#L415-L451","documentation":"Thrown by extractFirstHtmlExample when a component docs page markdown has no fenced ```html code block matching the expected pattern (an opening ```html line followed by content and a closing ```). The error names the docs file path. This runs while combining HTML examples for the preview.","triggerScenarios":"markdown.match(/^[ \\t]*```html[ \\t]*\\r?\\n([\\s\\S]*?)^[ \\t]*```[ \\t]*$/m) returns null on a docs page that the docs index mapped to a changed component.","commonSituations":"A component +page.md whose example uses a different fence label (e.g. ```tsx, ```html with extra text, indented fence that doesn't start at column 0 in a way the regex rejects), a docs page that documents only CSS with no HTML example, or a partially-written docs page in the PR.","solutions":["Open the named docs file and add a top-level ```html fenced example.","Ensure the fence is exactly ```html (no language suffix variants the regex won't match).","If the component genuinely has no HTML example, update the docs page to include one."],"exampleFix":"<!-- before: packages/docs/.../btn/+page.md -->\n```tsx\n<button class=\"btn\">X</button>\n```\n\n<!-- after -->\n```html\n<button class=\"btn\">X</button>\n```","handlingStrategy":"validation","validationCode":"import { readFileSync } from \"node:fs\"\nfunction assertHasHtmlExample(markdownPath) {\n  const md = readFileSync(markdownPath, \"utf8\")\n  if (!/^[ \\t]*```html[ \\t]*\\r?\\n([\\s\\S]*?)^[ \\t]*```[ \\t]*$/m.test(md)) {\n    throw new Error(`${markdownPath} needs a top-level \\`\\`\\`html fenced example`)\n  }\n}","typeGuard":"const hasHtmlFence = (md) => /^[ \\t]*```html[ \\t]*\\r?\\n([\\s\\S]*?)^[ \\t]*```[ \\t]*$/m.test(md)","tryCatchPattern":"try {\n  inputs = buildPreviewInputs(baseSha, headSha)\n} catch (error) {\n  if (/No fenced HTML example found in /.test(error.message)) {\n  // add a ```html block to the named docs page, then re-run\n  }\n  throw error\n}","preventionTips":["Every component +page.md should include a top-level ```html example.","Use the exact ```html fence label; avoid variant language suffixes.","Lint docs pages for an HTML fence in CI."],"tags":["docs","markdown","html-example","pr-preview"],"backgroundTag":null,"analyzedSha":"42b09e637e09467aa54a813a5aea53c1179aec75","analyzedAt":"2026-08-13T04:10:09.555Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}