Oscar Gonzalez Tur42 downloadsConvert Swagger/OpenAPI JSON files to Swagger-style Markdown.
Obsidian plugin to convert swagger.json or openapi.json files into static Swagger-style Markdown.
The goal is to generate API documentation that feels close to Swagger UI, but works well inside Obsidian notes and PDF exports. The plugin does not try to reproduce interactive Swagger UI controls such as Try it out, editable fields, or Execute buttons, because those controls do not provide value in static Markdown or PDF output.
.json files in your vault.full mode.fragment mode.tags.tag, operationId, HTTP method, and path.api-* classes so the bundled plugin CSS can render a Swagger-like layout.description fields, including tables, lists, code, tt, links, and line breaks.examples from request bodies, responses, and parameters.json, xml, or text.$ref values and reports warnings for unresolved internal, external, or remote references.For manual installation in a vault, copy these files:
main.js
manifest.json
styles.css
into:
VaultFolder/.obsidian/plugins/swaggerjson-to-markdown/
Then enable the plugin in Obsidian under Settings -> Community plugins.
.json file in Obsidian.Convert Swagger/OpenAPI to Markdown.Convert.You can also open a JSON file and run the command:
Convert active JSON to Swagger-style Markdown
The generated Markdown file is created next to the JSON file by default, unless you set an output folder in the modal or plugin settings.
full mode generates complete API documentation. It includes:
When full mode is selected, the modal automatically fixes all filters to All and disables tag, operation, operation ID, method, and path controls. This is intentional: full mode means the whole API document.
The generated note includes:
---
cssclasses:
- swagger-api-doc
- swagger-api-full
---
fragment mode generates a reusable piece of documentation. It is useful when you want to embed a specific tag or operation inside a larger hand-written note.
Fragments can be filtered by:
tagoperationIdThe generated fragment includes:
---
cssclasses:
- swagger-api-doc
- swagger-api-fragment
---
If you embed a generated fragment in another note with Obsidian embeds:
![[docs/generated/fragments/add-pet.md]]
the parent note should also include:
---
cssclasses:
- swagger-api-doc
---
This ensures the bundled plugin CSS applies correctly to the embedded content.
Mode: choose Full or Fragment.Tag: limits fragment output to operations with the selected tag.Operation: selects one specific operation from the current tag selection.Manual operation ID: filters by a specific operationId.Manual method and path: filters endpoints that do not have an operationId.Markdown headings: uses real Markdown headings, recommended for Obsidian outlines and PDF bookmarks.Fragment heading offset: changes the base heading level for fragments, from 1 to 5.Output folder: custom destination folder inside the vault. Empty means next to the JSON file.Markdown file name: output file name.Overwrite if it exists: replaces an existing Markdown file instead of creating a numbered file name.Open when finished: opens the generated note after conversion.The method and path controls are dynamic. Methods only show values available for the current tag selection, and paths only show values available for the selected method.
For each operation, the output includes static documentation equivalent to the useful reading parts of Swagger UI:
example and examples.Interactive Swagger UI controls are intentionally not generated:
Try it outExecute buttonsExamples are rendered as fenced Markdown code blocks:
```xml
<env:Header>
<ns3:Action>...</ns3:Action>
</env:Header>
```
This prevents XML examples from appearing as escaped text such as:
<env:Header>
In Obsidian and PDF exports, XML/JSON examples remain readable as code.
OpenAPI descriptions sometimes contain HTML. The plugin sanitizes this HTML and keeps useful content such as:
code and tthttp, https, and mailto linkscolspan and rowspan in tablesDescription tables receive the api-description-table class. The bundled CSS keeps them PDF-friendly with fixed layout, full width, wrapping, and smaller print sizing.
The Swagger-style CSS is bundled in the plugin styles.css file. You do not need to manually install a separate CSS snippet.
Generated notes include the required frontmatter:
---
cssclasses:
- swagger-api-doc
- swagger-api-full
---
Fragments use:
---
cssclasses:
- swagger-api-doc
- swagger-api-fragment
---
The styles are visible in Reading View and in rendered Markdown views. The final appearance can still vary depending on your active Obsidian theme.
For reliable PDF bookmarks, generate a document in full mode and export the generated Markdown file directly.
Recommended workflow:
full document..md file directly in Obsidian.Markdown headings enabled.For formal PDFs with bookmarks, the Obsidian plugin Better Export PDF is recommended. Obsidian's native PDF export may fail to create reliable bookmarks for complex documents that mix Markdown, HTML blocks, large tables, code blocks, and embedded fragments.
Avoid exporting a parent note that only embeds the generated full document:
![[docs/generated/api-full.md]]
Fragments are useful for manual documentation, but direct export of a full generated file is more reliable for final PDFs.
my-vault/
docs/
openapi/
swagger.json
generated/
api-full.md
fragments/
add-pet.md
One practical workflow is:
docs/openapi/.docs/generated/.docs/generated/fragments/.When Markdown generation fails, Obsidian shows a short notice and opens an error modal with the full details. The modal includes a Copy details button so the error can be copied into an issue, chat, or debugging note.
Errors can happen when:
openapi or swagger;info object;paths object;paths;Warnings do not stop generation. They are reported in the Obsidian developer console and the completion notice shows the warning count. Typical warnings include:
$ref;$ref;$ref;$ref values are not resolved.$ref values are not resolved.Check that:
cssclasses: swagger-api-doc;cssclasses: swagger-api-doc when embedding fragments.Use Better Export PDF and check that:
full document;Markdown headings was enabled;< and >The current generator emits examples as fenced code blocks, so XML should render as code rather than escaped HTML. Regenerate the document and check that the source example is declared as an OpenAPI example.
$ref WarningsCheck that the referenced schema, parameter, response, or component exists in the same JSON document. If your OpenAPI file uses external references, bundle it into a single JSON file before running the plugin.
Install dependencies:
npm install
Start the development build:
npm run dev
Create a production build:
npm run build
Run lint:
npm run lint
Based on the functionality from Krontur/swaggerjson_to_markdown.
Author: Oscar Gonzalez Tur
MIT.