(content: string, heading: string)
| 59 | } |
| 60 | |
| 61 | function extractMarkdownSection(content: string, heading: string): string { |
| 62 | const escaped = heading.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); |
| 63 | const startMatch = content.match(new RegExp(`^${escaped}.*$`, 'm')); |
| 64 | expect(startMatch?.index).toBeDefined(); |
| 65 | const start = startMatch!.index!; |
| 66 | const afterHeading = start + startMatch![0].length; |
| 67 | const nextSection = content.slice(afterHeading).match(/\n## /); |
| 68 | const end = nextSection?.index === undefined |
| 69 | ? content.length |
| 70 | : afterHeading + nextSection.index; |
| 71 | return content.slice(start, end).trim(); |
| 72 | } |
| 73 | |
| 74 | function extractPreambleBeforeWorkflow(content: string, workflowMarkers: string[]): string { |
| 75 | const markerIndexes = workflowMarkers |
no outgoing calls
no test coverage detected