Skip to content

Commit

Permalink
Support deeply nested namespaces (#84)
Browse files Browse the repository at this point in the history
  • Loading branch information
vecerek committed Nov 5, 2024
1 parent b77f746 commit 06b96a7
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 29 deletions.
7 changes: 7 additions & 0 deletions .changeset/witty-dryers-agree.md
Original file line number Diff line number Diff line change
@@ -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.
42 changes: 15 additions & 27 deletions schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,81 +7,69 @@
"required": [],
"properties": {
"$schema": {
"type": "string",
"description": "a string",
"title": "string"
"type": "string"
},
"projectHomepage": {
"type": "string",
"description": "Will link to the project homepage from the Auxiliary Links of the generated documentation.",
"title": "string"
"description": "Will link to the project homepage from the Auxiliary Links of the generated documentation."
},
"srcDir": {
"type": "string",
"description": "The directory in which docgen will search for TypeScript files to parse.",
"title": "string",
"default": "src"
},
"outDir": {
"type": "string",
"description": "The directory to which docgen will generate its output markdown documents.",
"title": "string",
"default": "docs"
},
"theme": {
"type": "string",
"description": "The theme that docgen will specify should be used for GitHub Docs in the generated _config.yml file.",
"title": "string",
"default": "mikearnaldi/just-the-docs"
},
"enableSearch": {
"type": "boolean",
"description": "Whether or not search should be enabled for GitHub Docs in the generated _config.yml file.",
"title": "boolean",
"default": true
},
"enforceDescriptions": {
"type": "boolean",
"description": "Whether or not descriptions for each module export should be required.",
"title": "boolean",
"default": false
},
"enforceExamples": {
"type": "boolean",
"description": "Whether or not @example tags for each module export should be required. (Note: examples will not be enforced in module documentation)",
"title": "boolean",
"default": false
},
"enforceVersion": {
"type": "boolean",
"description": "Whether or not @since tags for each module export should be required.",
"title": "boolean",
"default": true
},
"exclude": {
"type": "array",
"items": {
"type": "string",
"description": "a string",
"title": "string"
"type": "string"
},
"description": "An array of glob strings specifying files that should be excluded from the documentation.",
"default": []
},
"parseCompilerOptions": {
"anyOf": [
{
"type": "string",
"description": "a string",
"title": "string"
"type": "string"
},
{
"type": "object",
"required": [],
"properties": {},
"additionalProperties": {
"$id": "/schemas/unknown",
"title": "unknown"
"patternProperties": {
"": {
"$id": "/schemas/unknown",
"title": "unknown"
}
}
}
],
Expand All @@ -91,17 +79,17 @@
"examplesCompilerOptions": {
"anyOf": [
{
"type": "string",
"description": "a string",
"title": "string"
"type": "string"
},
{
"type": "object",
"required": [],
"properties": {},
"additionalProperties": {
"$id": "/schemas/unknown",
"title": "unknown"
"patternProperties": {
"": {
"$id": "/schemas/unknown",
"title": "unknown"
}
}
}
],
Expand Down
3 changes: 1 addition & 2 deletions src/Markdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit 06b96a7

Please sign in to comment.