Skip to content

fix(skill_engine): preserve multiline frontmatter values#106

Open
santhreal wants to merge 2 commits into
HKUDS:mainfrom
santhreal:fix/frontmatter-multiline-value
Open

fix(skill_engine): preserve multiline frontmatter values#106
santhreal wants to merge 2 commits into
HKUDS:mainfrom
santhreal:fix/frontmatter-multiline-value

Conversation

@santhreal

Copy link
Copy Markdown

Problem

set_frontmatter_field wrote raw newlines into YAML, so parse_frontmatter kept only the first line. Replacing a | block also left orphan indented lines.

Repro

from openspace.skill_engine.skill_utils import set_frontmatter_field, parse_frontmatter

out = set_frontmatter_field("---\nname: x\n---\n", "description", "line1\nline2")
assert parse_frontmatter(out)["description"] == "line1\nline2"  # was "line1"

Fix

Quote multiline scalars with escaped \n, unescape them in the no-PyYAML fallback, and drop old block continuation lines when replacing a field.

set_frontmatter_field wrote raw newlines into YAML, so parse_frontmatter
kept only the first line. Quote multiline scalars and drop old block
continuation lines when replacing a field.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant