MCPcopy Create free account
hub / github.com/github/gh-aw / extractIncludedMarkdownContent

Function extractIncludedMarkdownContent

pkg/parser/include_processor.go:324–344  ·  view source on GitHub ↗
(filePath, sectionName string, content []byte, visited map[string]struct {
}, extractTools bool)

Source from the content-addressed store, hash-verified

322}
323
324func extractIncludedMarkdownContent(filePath, sectionName string, content []byte, visited map[string]struct {
325}, extractTools bool) (string, error) {
326 markdownContent, err := ExtractMarkdownContent(string(content))
327 if err != nil {
328 return "", fmt.Errorf("failed to extract markdown from %s: %w", filePath, err)
329 }
330
331 includedDir := filepath.Dir(filePath)
332 markdownContent, err = processIncludesWithVisited(markdownContent, includedDir, extractTools, visited)
333 if err != nil {
334 return "", fmt.Errorf("failed to process nested includes in %s: %w", filePath, err)
335 }
336 if sectionName != "" {
337 sectionContent, sectionErr := ExtractMarkdownSection(markdownContent, sectionName)
338 if sectionErr != nil {
339 return "", fmt.Errorf("failed to extract section '%s' from %s: %w", sectionName, filePath, sectionErr)
340 }
341 return strings.Trim(sectionContent, "\n") + "\n", nil
342 }
343 return strings.Trim(markdownContent, "\n") + "\n", nil
344}
345
346// frontmatterContainsExpressions reports whether any string value in the frontmatter map
347// (recursively) contains an unsubstituted ${{ }} expression. Shared workflows that use

Callers 1

Calls 4

ExtractMarkdownContentFunction · 0.85
ExtractMarkdownSectionFunction · 0.85
ErrorfMethod · 0.45

Tested by

no test coverage detected