File tree Expand file tree Collapse file tree 1 file changed +13
-7
lines changed
Expand file tree Collapse file tree 1 file changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -180,14 +180,20 @@ fn add_filter_by_packages_param(
180180}
181181
182182pub fn snippet ( doc : String , search_input : String ) -> String {
183- // Extract first paragraph
184- let first_paragraph = case string . split ( doc , on : "\r \n \r \n " ) {
185- [ single ] ->
186- case string . split ( single , on : "\n \n " ) {
187- [ first , .. ] -> first
188- [ ] -> doc
183+ // Extract all paragraphs by splitting on both possible line endings
184+ let paragraphs =
185+ doc
186+ |> string . split ( on : "\r \n \r \n " )
187+ |> list . flat_map ( string . split ( _, on : "\n \n " ) )
188+
189+ // Get first usable paragraph (skip if starts with "#")
190+ let first_paragraph = case paragraphs {
191+ [ first , second , .. ] ->
192+ case string . starts_with ( string . trim ( first ) , "#" ) {
193+ True -> second
194+ False -> first
189195 }
190- [ first , .. ] -> first
196+ [ first ] -> first
191197 [ ] -> doc
192198 }
193199
You can’t perform that action at this time.
0 commit comments