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)
| 1072 | // XML comment removal, expression wrapping, expression extraction/substitution, and chunking. |
| 1073 | // It returns the prompt chunks and expression mappings extracted from the content. |
| 1074 | func 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"), |
no test coverage detected