Markdown exporter
Use the Markdown exporter when you want to turn a schema into human-readable field documentation, for example API field tables or internal data-contract notes. Start with a normal schema, then pass it to exporters.MarkdownExporter.export().
quick start
Install
Basic usage
Generated Markdown:
API reference
MarkdownExporter.export(schema, options)
Export JSON Schema to Markdown document. Parameters:
schema(Object) - JSON Schema objectoptions(Object) - Export optionstitle(String) - document title, default:'Schema Documentation'locale(String) - Language code, default:'en-US'- Support:
'zh-CN'(Chinese),'en-US'(English),'ja-JP'(Japanese)
- Support:
includeExample(Boolean) - Whether to include sample data, default:trueincludeDescription(Boolean) - Whether to include a description, default:true
Return value: String - Markdown text
Usage example
Example 1: Basic usage
Example 2: Using tags
Generate results:
Example 3: Complex Schema
Example 4: No examples included
Multi-language support
Supported languages
Chinese example
Output:
- Field list (Fields)
- Type: string, number, boolean
- Required: ✅ / ❌
English example
Output:
- Fields
- Type: String, Number, Boolean
- Required: ✅ / ❌
Japanese example
Output:
- Field list
- Type: string, number, boolean
- Required: ✅ / ❌
Custom options
Complete configuration example
save as file
type mapping table
basic type
format type
Advanced usage
Combine with other exporters
FAQ
Q: How to customize field descriptions?
A: Use .label()s( for the display name and ).description() for the field note. When both are present, Markdown output includes both pieces of metadata.
Q: What is the sample data generated?
A: The sample data contains all required fields, and values are automatically generated based on types and constraints:
- Email:
user@example.com - Number: Use
minimumor0 - String:
'example' - Boolean value:
true
Q: How to hide certain fields?
A: The Markdown exporter will export all fields. To hide, remove the field before generating.
Q: Are nested objects supported?
A: The current version mainly supports flat structure. Nested objects appear as type "Object".
Complete example
Corresponding sample file
Example entry: markdown-exporter.ts
Description: Covers the Chinese and English document generation and title/field placement check of MarkdownExporter.export(), suitable as a minimum template for document export.
Document update date: 2026-06-10