From 96403f6828edb22f8b2ae31ff85616eab442f9ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Attila=20Ve=C4=8Derek?= Date: Tue, 5 Nov 2024 07:25:46 +0100 Subject: [PATCH] Support deeply nested namespaces (#84) --- .changeset/witty-dryers-agree.md | 7 +++++++ src/Markdown.ts | 3 +-- 2 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 .changeset/witty-dryers-agree.md diff --git a/.changeset/witty-dryers-agree.md b/.changeset/witty-dryers-agree.md new file mode 100644 index 0000000..e0c2568 --- /dev/null +++ b/.changeset/witty-dryers-agree.md @@ -0,0 +1,7 @@ +--- +"@effect/docgen": patch +--- + +Support deeply nested namespaces. + +Previously, the docgen would fail with a `[Markdown] Unsupported namespace nesting: 4` error. With this change all namespace headers at depth level 3 and above would be rendered using H4 elements. diff --git a/src/Markdown.ts b/src/Markdown.ts index f6a21d6..2d30848 100644 --- a/src/Markdown.ts +++ b/src/Markdown.ts @@ -201,10 +201,9 @@ const getHeaderByIndentation = (indentation: number) => { return MarkdownPrinter.h2 case 1: return MarkdownPrinter.h3 - case 2: + default: return MarkdownPrinter.h4 } - throw new Error(`[Markdown] Unsupported namespace nesting: ${indentation + 1}`) } /** @internal */