autodoc: better short description algorithm

This commit is contained in:
r00ster91 2022-07-28 20:49:55 +02:00
parent e863292fe2
commit 2c7387aef5

View file

@ -2641,9 +2641,18 @@ var zigAnalysis;
function shortDescMarkdown(docs) { function shortDescMarkdown(docs) {
let parts = docs.trim().split("\n"); const trimmed_docs = docs.trim();
let firstLine = parts[0]; let index = trimmed_docs.indexOf('.');
return markdown(firstLine); if (index < 0) {
index = trimmed_docs.indexOf('\n');
if (index < 0) {
index = trimmed_docs.length;
}
} else {
index += 1; // include the period
}
const slice = trimmed_docs.slice(0, index);
return markdown(slice);
} }