Skip to content

Commit b63667d

Browse files
committed
autodocs: improve first-line descriptions
1 parent 583175d commit b63667d

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

lib/docs/main.js

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2835,16 +2835,20 @@ var zigAnalysis;
28352835

28362836
function shortDescMarkdown(docs) {
28372837
const trimmed_docs = docs.trim();
2838-
let index = trimmed_docs.indexOf(".");
2839-
if (index < 0) {
2840-
index = trimmed_docs.indexOf("\n");
2841-
if (index < 0) {
2842-
index = trimmed_docs.length;
2843-
}
2844-
} else {
2845-
index += 1; // include the period
2838+
let index = trimmed_docs.indexOf("\n\n");
2839+
let cut = false;
2840+
2841+
if (index < 0 || index > 80) {
2842+
if (trimmed_docs.length > 80) {
2843+
index = 80;
2844+
cut = true;
2845+
} else {
2846+
index = trimmed_docs.length;
2847+
}
28462848
}
2847-
const slice = trimmed_docs.slice(0, index);
2849+
2850+
let slice = trimmed_docs.slice(0, index);
2851+
if (cut) slice += "...";
28482852
return markdown(slice);
28492853
}
28502854

0 commit comments

Comments
 (0)