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

Function extractPromptChunksFromMarkdown

pkg/workflow/compiler_yaml.go:1074–1085  ·  view source on GitHub ↗

processMarkdownBody applies the standard post-processing pipeline to a markdown body: XML comment removal, expression wrapping, expression extraction/substitution, and chunking. It returns the prompt chunks and expression mappings extracted from the content.

(body string)

Source from the content-addressed store, hash-verified

1072// XML comment removal, expression wrapping, expression extraction/substitution, and chunking.
1073// It returns the prompt chunks and expression mappings extracted from the content.
1074func extractPromptChunksFromMarkdown(body string) ([]string, []*ExpressionMapping) {
1075 body = removeXMLComments(body)
1076 body = wrapExpressionsInTemplateConditionals(body)
1077 extractor := NewExpressionExtractor()
1078 exprMappings, err := extractor.ExtractExpressions(body)
1079 if err == nil && len(exprMappings) > 0 {
1080 body = extractor.ReplaceExpressionsWithEnvVars(body)
1081 } else {
1082 exprMappings = nil
1083 }
1084 return splitContentIntoChunks(body), exprMappings
1085}
1086
1087// resolveWorkspaceRoot returns the workspace root directory given the path to a workflow markdown
1088// file. ImportPaths are relative to the workspace root (e.g. ".github/workflows/shared/foo.md"),

Callers 1

generatePromptMethod · 0.85

Calls 6

ExtractExpressionsMethod · 0.95
NewExpressionExtractorFunction · 0.85
splitContentIntoChunksFunction · 0.85
removeXMLCommentsFunction · 0.70

Tested by

no test coverage detected