mkdocs-swagger-ui-tag


Namemkdocs-swagger-ui-tag JSON
Version 0.6.10 PyPI version JSON
download
home_pagehttps://blueswen.github.io/mkdocs-swagger-ui-tag
SummaryA MkDocs plugin supports for add Swagger UI in page.
upload_time2024-05-01 07:41:51
maintainerNone
docs_urlNone
authorBlueswen
requires_pythonNone
licenseMIT
keywords mkdocs plugin swagger-ui openapi
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # MkDocs Swagger UI Tag

<p align="center">
<a target="_blank" href="https://pypi.org/project/mkdocs-swagger-ui-tag"><img src="https://img.shields.io/pypi/v/mkdocs-swagger-ui-tag.svg" alt="PyPI version"/></a>
<a target="_blank" href="https://pypi.org/project/mkdocs-swagger-ui-tag"><img src="https://img.shields.io/pypi/dm/mkdocs-swagger-ui-tag.svg" alt="PyPI downloads"/></a>
<a target="_blank" href="https://codecov.io/gh/blueswen/mkdocs-swagger-ui-tag"><img src="https://codecov.io/gh/blueswen/mkdocs-swagger-ui-tag/branch/main/graph/badge.svg?token=1D1B0GAQN1" alt="Codecov"/></a>
</p>

A MkDocs plugin supports adding [Swagger UI](https://github.com/swagger-api/swagger-ui) to the page.

[Live demo](https://blueswen.github.io/mkdocs-swagger-ui-tag/) with [Material for MkDocs](https://squidfunk.github.io/mkdocs-material/).

## Features

1. OpenAPI Specification file from online over URL or static file in docs
2. All dependencies are using static files handled by the plugin not from CDN, especially suitable for those documents been deployed in the intranet
3. Multiple Swagger UI on the same page
4. Synchronized dark mode with [Material for MkDocs](https://squidfunk.github.io/mkdocs-material/)
5. Configure [Swagger UI configuration](https://swagger.io/docs/open-source-tools/swagger-ui/usage/configuration/) through plugin options and tag attributes
6. Support multiple OAS in a single Swagger UI with a top bar selector
7. Support Swagger UI [initOAuth](https://swagger.io/docs/open-source-tools/swagger-ui/usage/oauth2/) method

## Dependency

1. Python Package
    1. beautifulsoup4>=4.11.1
2. [Swagger UI dist](https://www.npmjs.com/package/swagger-ui-dist) javascript file and CSS file
    1. swagger-ui-dist==5.17.3

## Usage

1. Install the plugin from PyPI

    ```bash
    pip install mkdocs-swagger-ui-tag
    ```

2. Add ```swagger-ui-tag``` plugin to your mkdocs.yml plugins sections:

    ```yaml
    plugins:
       - swagger-ui-tag
    ```

3. Add ```swagger-ui``` tag in markdown to include Swagger UI

    ```markdown
    <swagger-ui src="https://petstore.swagger.io/v2/swagger.json"/>
    ```

    ![Swagger UI Sample Image](https://blueswen.github.io/mkdocs-swagger-ui-tag/sample.png)

4. You may customize the plugin by passing options in mkdocs.yml, check more details on [options](https://blueswen.github.io/mkdocs-swagger-ui-tag/options/):

    ```yaml
    plugins:
       - swagger-ui-tag:
            background: White
            docExpansion: none
            filter: ""
            syntaxHighlightTheme: monokai
            tryItOutEnabled: ['get', 'post']
    ```

    | Options | Type | Description |
    |---|---|---|
    | background | String | Default: "". Swagger UI iframe body background attribute value. You can use any css value for background for example "#74b9ff" or "Gainsboro" or "" for nothing. |
    | docExpansion | String | Default: "list". Controls the default expansion setting for the operations and tags. It can be "list" (expands only the tags), "full" (expands the tags and operations) or "none" (expands nothing). |
    | filter | String or Boolean | Default: False. If set, enables filtering. The top bar will show an edit box that you can use to filter the tagged operations that are shown. Can be Boolean to enable or disable, or a string, in which case filtering will be enabled using that string as the filter expression. Filtering is case sensitive matching the filter expression anywhere inside the tag. |
    | syntaxHighlightTheme | String | Default: "agate". [Highlight.js](https://highlightjs.org/static/demo/) syntax coloring theme to use. It can be "agate", "arta", "monokai", "nord", "obsidian" or "tomorrow-night" |
    | tryItOutEnabled | Boolean | Default: False. This setting determines the default editability of the "Try it out" section, including parameters or body. |
    | oauth2RedirectUrl | String | Default: Absolute URL of "/assets/swagger-ui/oauth2-redirect.html" relative with site_url in mkdocs.yml or document root path on site without site_url, e.g. "[https://blueswen.github.io/mkdocs-swagger-ui-tag/assets/swagger-ui/oauth2-redirect.html](https://blueswen.github.io/mkdocs-swagger-ui-tag/assets/swagger-ui/oauth2-redirect.html)". OAuth redirect URL. |
    | supportedSubmitMethods | Array | Default: All Http Methods. Array=["get", "put", "post", "delete", "options", "head", "patch", "trace"]. List of HTTP methods that have the "Try it out" feature enabled. An empty array disables "Try it out" for all operations. This does not filter the operations from the display. |
    | validatorUrl | String | Default: "https://validator.swagger.io/validator". By default, Swagger UI attempts to validate specs against swagger.io's online validator in multiple OAS Swagger UI. You can use this parameter to set a different validator URL, for example for locally deployed validators ([Validator Badge](https://github.com/swagger-api/validator-badge)). Setting it "none" to disable validation. |

## How it works

1. Copy the Swagger UI script file into `site/assets/javascripts/` directory, the CSS file into `site/assets/stylesheets/` directory, and the [default Oauth2 redirect html](https://github.com/blueswen/mkdocs-swagger-ui-tag/blob/main/mkdocs_swagger_ui_tag/swagger-ui/oauth2-redirect.html) into `site/assets/swagger-ui/` directory
2. Search all swagger-ui tags, then convert them to an iframe tag and generate the iframe target HTML with the given OpenAPI Specification src path and options

## License

This project is licensed under the MIT License - see the [LICENSE.md](https://github.com/Blueswen/mkdocs-swagger-ui-tag/blob/main/LICENSE) file for details.

## Reference

1. [Amoenus Swagger Dark Theme](https://github.com/Amoenus/SwaggerDark/): source of dark mode css



            

Raw data

            {
    "_id": null,
    "home_page": "https://blueswen.github.io/mkdocs-swagger-ui-tag",
    "name": "mkdocs-swagger-ui-tag",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "mkdocs, plugin, swagger-ui, openapi",
    "author": "Blueswen",
    "author_email": "blueswen.tw@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/3f/62/7eaba00f7687b30fe7d3d938a58b48cb8276d002f65de0e160b7650cd822/mkdocs-swagger-ui-tag-0.6.10.tar.gz",
    "platform": null,
    "description": "# MkDocs Swagger UI Tag\n\n<p align=\"center\">\n<a target=\"_blank\" href=\"https://pypi.org/project/mkdocs-swagger-ui-tag\"><img src=\"https://img.shields.io/pypi/v/mkdocs-swagger-ui-tag.svg\" alt=\"PyPI version\"/></a>\n<a target=\"_blank\" href=\"https://pypi.org/project/mkdocs-swagger-ui-tag\"><img src=\"https://img.shields.io/pypi/dm/mkdocs-swagger-ui-tag.svg\" alt=\"PyPI downloads\"/></a>\n<a target=\"_blank\" href=\"https://codecov.io/gh/blueswen/mkdocs-swagger-ui-tag\"><img src=\"https://codecov.io/gh/blueswen/mkdocs-swagger-ui-tag/branch/main/graph/badge.svg?token=1D1B0GAQN1\" alt=\"Codecov\"/></a>\n</p>\n\nA MkDocs plugin supports adding [Swagger UI](https://github.com/swagger-api/swagger-ui) to the page.\n\n[Live demo](https://blueswen.github.io/mkdocs-swagger-ui-tag/) with [Material for MkDocs](https://squidfunk.github.io/mkdocs-material/).\n\n## Features\n\n1. OpenAPI Specification file from online over URL or static file in docs\n2. All dependencies are using static files handled by the plugin not from CDN, especially suitable for those documents been deployed in the intranet\n3. Multiple Swagger UI on the same page\n4. Synchronized dark mode with [Material for MkDocs](https://squidfunk.github.io/mkdocs-material/)\n5. Configure [Swagger UI configuration](https://swagger.io/docs/open-source-tools/swagger-ui/usage/configuration/) through plugin options and tag attributes\n6. Support multiple OAS in a single Swagger UI with a top bar selector\n7. Support Swagger UI [initOAuth](https://swagger.io/docs/open-source-tools/swagger-ui/usage/oauth2/) method\n\n## Dependency\n\n1. Python Package\n    1. beautifulsoup4>=4.11.1\n2. [Swagger UI dist](https://www.npmjs.com/package/swagger-ui-dist) javascript file and CSS file\n    1. swagger-ui-dist==5.17.3\n\n## Usage\n\n1. Install the plugin from PyPI\n\n    ```bash\n    pip install mkdocs-swagger-ui-tag\n    ```\n\n2. Add ```swagger-ui-tag``` plugin to your mkdocs.yml plugins sections:\n\n    ```yaml\n    plugins:\n       - swagger-ui-tag\n    ```\n\n3. Add ```swagger-ui``` tag in markdown to include Swagger UI\n\n    ```markdown\n    <swagger-ui src=\"https://petstore.swagger.io/v2/swagger.json\"/>\n    ```\n\n    ![Swagger UI Sample Image](https://blueswen.github.io/mkdocs-swagger-ui-tag/sample.png)\n\n4. You may customize the plugin by passing options in mkdocs.yml, check more details on [options](https://blueswen.github.io/mkdocs-swagger-ui-tag/options/):\n\n    ```yaml\n    plugins:\n       - swagger-ui-tag:\n            background: White\n            docExpansion: none\n            filter: \"\"\n            syntaxHighlightTheme: monokai\n            tryItOutEnabled: ['get', 'post']\n    ```\n\n    | Options | Type | Description |\n    |---|---|---|\n    | background | String | Default: \"\". Swagger UI iframe body background attribute value. You can use any css value for background for example \"#74b9ff\" or \"Gainsboro\" or \"\" for nothing. |\n    | docExpansion | String | Default: \"list\". Controls the default expansion setting for the operations and tags. It can be \"list\" (expands only the tags), \"full\" (expands the tags and operations) or \"none\" (expands nothing). |\n    | filter | String or Boolean | Default: False. If set, enables filtering. The top bar will show an edit box that you can use to filter the tagged operations that are shown. Can be Boolean to enable or disable, or a string, in which case filtering will be enabled using that string as the filter expression. Filtering is case sensitive matching the filter expression anywhere inside the tag. |\n    | syntaxHighlightTheme | String | Default: \"agate\". [Highlight.js](https://highlightjs.org/static/demo/) syntax coloring theme to use. It can be \"agate\", \"arta\", \"monokai\", \"nord\", \"obsidian\" or \"tomorrow-night\" |\n    | tryItOutEnabled | Boolean | Default: False. This setting determines the default editability of the \"Try it out\" section, including parameters or body. |\n    | oauth2RedirectUrl | String | Default: Absolute URL of \"/assets/swagger-ui/oauth2-redirect.html\" relative with site_url in mkdocs.yml or document root path on site without site_url, e.g. \"[https://blueswen.github.io/mkdocs-swagger-ui-tag/assets/swagger-ui/oauth2-redirect.html](https://blueswen.github.io/mkdocs-swagger-ui-tag/assets/swagger-ui/oauth2-redirect.html)\". OAuth redirect URL. |\n    | supportedSubmitMethods | Array | Default: All Http Methods. Array=[\"get\", \"put\", \"post\", \"delete\", \"options\", \"head\", \"patch\", \"trace\"]. List of HTTP methods that have the \"Try it out\" feature enabled. An empty array disables \"Try it out\" for all operations. This does not filter the operations from the display. |\n    | validatorUrl | String | Default: \"https://validator.swagger.io/validator\". By default, Swagger UI attempts to validate specs against swagger.io's online validator in multiple OAS Swagger UI. You can use this parameter to set a different validator URL, for example for locally deployed validators ([Validator Badge](https://github.com/swagger-api/validator-badge)). Setting it \"none\" to disable validation. |\n\n## How it works\n\n1. Copy the Swagger UI script file into `site/assets/javascripts/` directory, the CSS file into `site/assets/stylesheets/` directory, and the [default Oauth2 redirect html](https://github.com/blueswen/mkdocs-swagger-ui-tag/blob/main/mkdocs_swagger_ui_tag/swagger-ui/oauth2-redirect.html) into `site/assets/swagger-ui/` directory\n2. Search all swagger-ui tags, then convert them to an iframe tag and generate the iframe target HTML with the given OpenAPI Specification src path and options\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE.md](https://github.com/Blueswen/mkdocs-swagger-ui-tag/blob/main/LICENSE) file for details.\n\n## Reference\n\n1. [Amoenus Swagger Dark Theme](https://github.com/Amoenus/SwaggerDark/): source of dark mode css\n\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A MkDocs plugin supports for add Swagger UI in page.",
    "version": "0.6.10",
    "project_urls": {
        "Homepage": "https://blueswen.github.io/mkdocs-swagger-ui-tag",
        "Source": "https://github.com/Blueswen/mkdocs-swagger-ui-tag"
    },
    "split_keywords": [
        "mkdocs",
        " plugin",
        " swagger-ui",
        " openapi"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3bf6031d7bed78ec1e8a1fc033fda7946dd925cd5d5d099422b64f170e5a4cd5",
                "md5": "f234c86f7bec59cb8d03e8a28668aef9",
                "sha256": "839373498a42202b3824068064919ad6ddf2e98d5a8deed7d4132719221c0528"
            },
            "downloads": -1,
            "filename": "mkdocs_swagger_ui_tag-0.6.10-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f234c86f7bec59cb8d03e8a28668aef9",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 2752886,
            "upload_time": "2024-05-01T07:41:42",
            "upload_time_iso_8601": "2024-05-01T07:41:42.400916Z",
            "url": "https://files.pythonhosted.org/packages/3b/f6/031d7bed78ec1e8a1fc033fda7946dd925cd5d5d099422b64f170e5a4cd5/mkdocs_swagger_ui_tag-0.6.10-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3f627eaba00f7687b30fe7d3d938a58b48cb8276d002f65de0e160b7650cd822",
                "md5": "bcb42bf6bc260ee2ec4e64ec4fff68b8",
                "sha256": "811d55e0905bfecc5f2e743b5b1e4d03b663707d5472984cc7b21f45117dcb29"
            },
            "downloads": -1,
            "filename": "mkdocs-swagger-ui-tag-0.6.10.tar.gz",
            "has_sig": false,
            "md5_digest": "bcb42bf6bc260ee2ec4e64ec4fff68b8",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 1272720,
            "upload_time": "2024-05-01T07:41:51",
            "upload_time_iso_8601": "2024-05-01T07:41:51.154014Z",
            "url": "https://files.pythonhosted.org/packages/3f/62/7eaba00f7687b30fe7d3d938a58b48cb8276d002f65de0e160b7650cd822/mkdocs-swagger-ui-tag-0.6.10.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-01 07:41:51",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Blueswen",
    "github_project": "mkdocs-swagger-ui-tag",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "mkdocs-swagger-ui-tag"
}
        
Elapsed time: 0.25126s