type UnreleasedSection = "Breaking" | "Changes" | "Fixes";
function findSectionRange(
lines: string[],
section: UnreleasedSection,
): {
start: number;
insertAt: number;
} { const unreleasedIndex = lines.findIndex((line) => line.trim() === "## Unreleased"); if (unreleasedIndex === -1) { thrownew Error("CHANGELOG.md is missing the '## Unreleased' heading.");
}
const sectionHeading = `### ${section}`;
let sectionIndex = -1; for (let index = unreleasedIndex + 1; index < lines.length; index += 1) { const line = lines[index]; if (line.startsWith("## ")) { break;
} if (line.trim() === sectionHeading) {
sectionIndex = index; break;
}
} if (sectionIndex === -1) { thrownew Error(`CHANGELOG.md is missing the '${sectionHeading}' section under Unreleased.`);
}
let insertAt = lines.length; for (let index = sectionIndex + 1; index < lines.length; index += 1) { const line = lines[index]; if (line.startsWith("### ") || line.startsWith("## ")) {
insertAt = index; break;
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.