| 271 | }; |
| 272 | |
| 273 | const extractEntry = listItem => { |
| 274 | const paragraph = listItem.children?.find(child => child.type === 'paragraph'); |
| 275 | if (!paragraph || !Array.isArray(paragraph.children)) { |
| 276 | return null; |
| 277 | } |
| 278 | |
| 279 | const linkIndex = paragraph.children.findIndex(child => child.type === 'link'); |
| 280 | if (linkIndex === -1) { |
| 281 | return null; |
| 282 | } |
| 283 | |
| 284 | const link = paragraph.children[linkIndex]; |
| 285 | const title = toText(link).trim(); |
| 286 | const entryPath = link.url; |
| 287 | if (!title || !entryPath) { |
| 288 | return null; |
| 289 | } |
| 290 | |
| 291 | let description = paragraph.children |
| 292 | .slice(linkIndex + 1) |
| 293 | .map(toText) |
| 294 | .join('') |
| 295 | .trim(); |
| 296 | |
| 297 | if (description.startsWith(':')) { |
| 298 | description = description.slice(1).trim(); |
| 299 | } |
| 300 | |
| 301 | return { |
| 302 | title, |
| 303 | path: entryPath, |
| 304 | description |
| 305 | }; |
| 306 | }; |
| 307 | |
| 308 | const walk = node => { |
| 309 | if (!node || !Array.isArray(node.children)) { |