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

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.5.tar.gz (6.1 kB view details)

Uploaded Source

File details

Details for the file swagger-markdown-0.9.5.tar.gz.

File metadata

  • Download URL: swagger-markdown-0.9.5.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.1

File hashes

Hashes for swagger-markdown-0.9.5.tar.gz
Algorithm Hash digest
SHA256 7ff59336910bc13d881f5c524173d789640b571a1b156848f90e9a3bb3e694d6
MD5 c634b1f3c1c352fcf481340041c89972
BLAKE2b-256 9fb4b4bb5504fabcbb5935d1296d9964af605fcbe75126dee6302b042df5d181

See more details on using hashes here.

Supported by

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