Commit 2c7387aef5

r00ster91 <r00ster91@proton.me>
2022-07-28 20:49:55
autodoc: better short description algorithm
1 parent e863292
Changed files (1)
lib
docs
lib/docs/main.js
@@ -2639,14 +2639,23 @@ var zigAnalysis;
         });
     }
 
-    
+
     function shortDescMarkdown(docs) {
-        let parts = docs.trim().split("\n");
-        let firstLine = parts[0];
-        return markdown(firstLine);
+        const trimmed_docs = docs.trim();
+        let index = trimmed_docs.indexOf('.');
+        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);
     }
 
-    
+
     function markdown(input) {
         const raw_lines = input.split('\n'); // zig allows no '\r', so we don't need to split on CR