mirror of
https://github.com/agentscope-ai/ReMe.git
synced 2026-09-10 22:41:06 +00:00
* refactor(packaging): reorganize published packages * fix(packaging): install AgentScope extra in wheel smoke * docs: align package guides and documentation site * ci(workflow): add core dependency verification step in Python package build - Add a workflow step to verify released core dependencies by installing the wheel with core extras - Assert the presence of the static index.html file to ensure proper package contents - Create and use a temporary virtual environment for isolation during verification - Keep existing artifacts upload step intact and conditional on inputs.upload_artifacts flag * fix(ci): update package installation dependencies in Windows workflow - Change pip install from editable reme_studio and core to only dev and as extras - Remove installation of reme_studio and core to streamline dependency setup - Ensure Windows CI uses the correct extras for testing environment * fix(tests): add missing commas in toml file reads in package version tests - Added trailing commas in the tomllib.loads calls for auto-fin and daily_paper configs - Ensured consistent syntax to prevent potential tuple misinterpretation - Improved readability and correctness of the test setup code * fix(packaging): protect qwenpaw releases and test Studio health
27 lines
874 B
TypeScript
27 lines
874 B
TypeScript
export interface FrontmatterEntry {
|
|
key: string;
|
|
value: string;
|
|
}
|
|
|
|
const FRONTMATTER_PATTERN = /^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/;
|
|
|
|
/** Split a leading YAML frontmatter block from the Markdown body. Copied from QwenPaw. */
|
|
export function parseMarkdownFrontmatter(content: string): {
|
|
body: string;
|
|
entries: FrontmatterEntry[];
|
|
} {
|
|
const match = FRONTMATTER_PATTERN.exec(content);
|
|
if (!match) return { body: content, entries: [] };
|
|
const entries = match[1]
|
|
.split(/\r?\n/)
|
|
.map((line) => {
|
|
const separator = line.indexOf(":");
|
|
if (separator <= 0 || /^\s/.test(line)) return null;
|
|
return {
|
|
key: line.slice(0, separator).trim(),
|
|
value: line.slice(separator + 1).trim(),
|
|
};
|
|
})
|
|
.filter((entry): entry is FrontmatterEntry => entry !== null);
|
|
return { body: content.slice(match[0].length), entries };
|
|
}
|