Python: Parse YAML block scalars in SKILL.md frontmatter#5863
Merged
SergeyMenshykh merged 1 commit intoMay 15, 2026
Merged
Conversation
The frontmatter parser previously matched only single-line `key: value` pairs, so block scalar indicators (`|` literal, `>` folded, with chomping `-`/`+`) were silently truncated to the indicator character. Multi-line descriptions like `description: >\n ...` lost their content. Add `_parse_yaml_scalar_value()` which detects block scalar indicators, collects indented continuation lines, strips the common leading indentation, joins per scalar style (newlines for `|`, spaces for `>`), and applies chomping per the YAML 1.2 spec. Update `_extract_frontmatter()` to use the helper for unquoted values. Adds 15 unit tests covering literal/folded styles, all chomping variants, indentation handling, content containing colons, non-description fields, tab indentation, blank-line preservation, and a regression test for plain values. Fixes microsoft#5713. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
Python Test Coverage Report •
Python Unit Test Overview
|
||||||||||||||||||||||||||||||
moonbox3
approved these changes
May 15, 2026
westey-m
approved these changes
May 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation and Context
Fixes #5713. The Python
_extract_frontmatter()parser only matched single-linekey: valuepairs, so YAML block scalar indicators (|literal,>folded, with chomping-/+) were silently truncated to the indicator character. Multi-line frontmatter values likedescription: >\n ...lost their content.This actively affects the SKILL.md files under
python/.github/skills/, all of which usedescription: >.Description
_parse_yaml_scalar_value()to_skills.py: detects block scalar indicators, collects indented continuation lines, strips common leading indentation, joins per scalar style (newlines for|, spaces for>), and applies chomping per the YAML 1.2 spec._extract_frontmatter()to use the helper for unquoted values.Contribution Checklist