docs-util: fix examples in workflow reference that have multiple code (#12223)

This commit is contained in:
Shahed Nasser
2025-04-17 18:47:09 +03:00
committed by GitHub
parent f492a1a475
commit 8b5b96a83d
3 changed files with 14 additions and 340 deletions
@@ -24,11 +24,17 @@ export default function () {
} else {
exampleTags.forEach((exampleTag) => {
exampleTag.content.forEach((part) => {
if (
part.kind !== "code" ||
part.text.startsWith("```ts workflow={false}")
) {
exampleStr.push(part.text)
const isCode = part.kind === "code"
const isCodeBlock = part.text.startsWith("```")
const isWorkflowDisabled = part.text.startsWith(
"```ts workflow={false}"
)
if (!isCode || !isCodeBlock || isWorkflowDisabled) {
if (!isCodeBlock && exampleStr.length > 0) {
exampleStr[exampleStr.length - 1] += part.text
} else {
exampleStr.push(part.text)
}
return
}