Skip to main content

A Python Markdown extension to include Swagger informations in your documentation

Project description

swagger-markdown

A Python Markdown extension to include Swagger definition and paths in your markdown documentation. This extension works with Swagger 2.0 JSON files.

To install:

pip install swagger-markdown

How to use with python-markdown

import markdown
import unittest
from swaggermarkdown import SwaggerExtension

md = markdown.Markdown(extensions=[SwaggerExtension()])
text = ':swg-def: tests/test_swagger.json FirstDefinition'
converted = md.convert(text)

Or more simply

import markdown

markdown.markdown('some markdown', extensions=['swaggermarkdown']))

Configuration

SwaggerExtension(
  definitionsUrlRoot='/types',    # add an url in front of definition links
  file='tests/test_swagger.json'  # redefine the default file (default: swagger.json)
)

How to use with MkDocs

markdown_extensions:
  - swaggermarkdown

How to use in your markdown files

## My Pet Api

### Endpoint /pet/findByTags

:swg-path: /pet/findByTags

### Pet definition

:swg-def: Pet

You should get a table similar to this

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

swagger-markdown-0.9.6.tar.gz (6.5 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page