(module: Domain.Module)
| 318 | * @since 0.6.0 |
| 319 | */ |
| 320 | export const printModule = (module: Domain.Module) => { |
| 321 | return Effect.gen(function*() { |
| 322 | const description = yield* printModel(module.name, module.doc, { |
| 323 | postfix: "overview" |
| 324 | }) |
| 325 | |
| 326 | const printables = pipe( |
| 327 | sortByName(getPrintables(module)), |
| 328 | Array.groupBy((printable) => |
| 329 | printable.doc.category.length === 0 ? DEFAULT_CATEGORY : printable.doc.category.join(", ") |
| 330 | ), |
| 331 | Record.toEntries, |
| 332 | Array.sort(byCategory) |
| 333 | ) |
| 334 | |
| 335 | const strings = yield* Effect.forEach(printables, ([category, printables]) => |
| 336 | Effect.gen(function*() { |
| 337 | const out = `\n\n# ${category}` |
| 338 | const strings = yield* Effect.forEach(sortByName(printables), (printable) => print(printable)) |
| 339 | return out + strings.map((s) => "\n\n" + s).join("") |
| 340 | })) |
| 341 | |
| 342 | const content = strings.join("") |
| 343 | |
| 344 | return `${description} |
| 345 | |
| 346 | <!-- toc -->${content}` |
| 347 | }).pipe(Effect.provideService(Parser.Source, module.source)) |
| 348 | } |
| 349 | |
| 350 | const defaultPrettierOptions: Prettier.Options = { |
| 351 | parser: "markdown", |
nothing calls this directly
no test coverage detected