authorgravatar for kappaloris@gmail.comLoris Cro <kappaloris@gmail.com> 2022-08-26 16:35:00+02:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2022-08-26 16:35:00+02:00
loga69a16c6bdf2d3ff88eae1a717552871fae47b16
tree61548b4f7a0febc43ae2c2431c873407d6495afd
parent02e696096633bc588b0931d4dc5aba4be4cd97f1
parentb63667dda33aa8b2f9aafd5923f8c3b9034e90db
signaturebadge-question-mark Signed by PGP key 4AEE18F83AFDEB23

Merge pull request #12601 from ominitay/autodocs-shortdesc

autodocs: improve first-line descriptions

1 files changed, 13 insertions(+), 9 deletions(-)

lib/docs/main.js+13-9
...@@ -2839,16 +2839,20 @@ var zigAnalysis;...@@ -2839,16 +2839,20 @@ var zigAnalysis;
28392839
2840 function shortDescMarkdown(docs) {2840 function shortDescMarkdown(docs) {
2841 const trimmed_docs = docs.trim();2841 const trimmed_docs = docs.trim();
2842 let index = trimmed_docs.indexOf(".");2842 let index = trimmed_docs.indexOf("\n\n");
2843 if (index < 0) {2843 let cut = false;
2844 index = trimmed_docs.indexOf("\n");2844
2845 if (index < 0) {2845 if (index < 0 || index > 80) {
2846 index = trimmed_docs.length;2846 if (trimmed_docs.length > 80) {
2847 }2847 index = 80;
2848 } else {2848 cut = true;
2849 index += 1; // include the period2849 } else {
2850 index = trimmed_docs.length;
2851 }
2850 }2852 }
2851 const slice = trimmed_docs.slice(0, index);2853
2854 let slice = trimmed_docs.slice(0, index);
2855 if (cut) slice += "...";
2852 return markdown(slice);2856 return markdown(slice);
2853 }2857 }
28542858