redoc-express
Advanced tools
@@ -5,2 +5,3 @@ export interface Ioption { | ||
| nonce?: string; | ||
| redocOptions?: object; | ||
| } | ||
@@ -7,0 +8,0 @@ declare function redocHtml(options?: Ioption): string; |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.redocHtml = void 0; | ||
| var html = "<!DOCTYPE html>\n<html>\n <head>\n <title>[[title]]</title>\n <meta charset=\"utf-8\"/>\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n <link href=\"https://fonts.googleapis.com/css?family=Montserrat:300,400,700|Roboto:300,400,700\" rel=\"stylesheet\">\n <style>\n body {\n margin: 0;\n padding: 0;\n }\n </style>\n </head>\n <body>\n <redoc spec-url='[[spec-url]]'></redoc>\n <script nonce='[[nonce]]' src=\"https://unpkg.com/redoc@latest/bundles/redoc.standalone.js\"> </script>\n </body>\n</html>"; | ||
| var html = "<!DOCTYPE html>\n<html>\n <head>\n <title>[[title]]</title>\n <meta charset=\"utf-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n <link href=\"https://fonts.googleapis.com/css?family=Montserrat:300,400,700|Roboto:300,400,700\" rel=\"stylesheet\" />\n <style>\n body {\n margin: 0;\n padding: 0;\n }\n </style>\n </head>\n <body>\n <div id=\"redoc-container\"></div>\n <script nonce='[[nonce]]' src=\"https://unpkg.com/redoc@latest/bundles/redoc.standalone.js\"> </script>\n </body>\n <script>\n Redoc.init(\n \"[[spec-url]]\",\n [[options]],\n document.getElementById(\"redoc-container\")\n );\n </script>\n</html>"; | ||
| function redocHtml(options) { | ||
@@ -10,9 +10,10 @@ if (options === void 0) { options = { | ||
| }; } | ||
| var title = options.title, specUrl = options.specUrl, _a = options.nonce, nonce = _a === void 0 ? '' : _a; | ||
| var title = options.title, specUrl = options.specUrl, _a = options.nonce, nonce = _a === void 0 ? '' : _a, _b = options.redocOptions, redocOptions = _b === void 0 ? {} : _b; | ||
| return html | ||
| .replace('[[title]]', title) | ||
| .replace('[[spec-url]]', specUrl) | ||
| .replace('[[nonce]]', nonce); | ||
| .replace('[[nonce]]', nonce) | ||
| .replace('[[options]]', JSON.stringify(redocOptions)); | ||
| } | ||
| exports.redocHtml = redocHtml; | ||
| exports.default = redocHtml; |
+1
-1
| { | ||
| "name": "redoc-express", | ||
| "version": "2.0.0", | ||
| "version": "2.1.0", | ||
| "description": "Express Middleware for OpenAPI/Swagger-generated API Reference Documentation", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
+25
-1
@@ -41,3 +41,27 @@ # [redoc-express][redoc-express] | ||
| specUrl: '/docs/swagger.json', | ||
| nonce:'' // <= it is optional,we can omit this key and value | ||
| nonce: '', // <= it is optional,we can omit this key and value | ||
| // we are now start supporting the redocOptions object | ||
| // you can omit the options object if you don't need it | ||
| // https://redocly.com/docs/api-reference-docs/configuration/functionality/ | ||
| redocOptions: { | ||
| theme: { | ||
| colors: { | ||
| primary: { | ||
| main: '#6EC5AB' | ||
| } | ||
| }, | ||
| typography: { | ||
| fontFamily: `"museo-sans", 'Helvetica Neue', Helvetica, Arial, sans-serif`, | ||
| fontSize: '15px', | ||
| lineHeight: '1.5', | ||
| code: { | ||
| code: '#87E8C7', | ||
| backgroundColor: '#4D4D4E' | ||
| } | ||
| }, | ||
| menu: { | ||
| backgroundColor: '#ffffff' | ||
| } | ||
| } | ||
| } | ||
| }) | ||
@@ -44,0 +68,0 @@ ); |
7256
15.62%48
6.67%105
29.63%