Skip to content

Add extract section to md-utils #11

@DavidWells

Description

@DavidWells

We want to add a new utility to the Markdown utilities that will extract the entire section of a Markdown file based off the header below is an example implementation. Go ahead and add this or something like this and then add the tests as well using the UVU framework.

function extractSection(content: string, sectionTitle: string): string | undefined {
	const regex = new RegExp(`## ${sectionTitle}\\s*\\n([\\s\\S]*?)(?=\\n## |$)`, "i");
	const match = content.match(regex);
	return match?.[1]?.trim();
}

@claude

Metadata

Metadata

Assignees

No one assigned

    Labels

    auto-generatedAutomatically generated contentclaude-codeItems created or modified by Claude Code

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions