diff --git a/CHANGELOG.md b/CHANGELOG.md index e8484a94..a22943e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,14 @@ +# [2.0.0-rc.2](https://github.com/Rebilly/ReDoc/compare/v2.0.0-rc.1...v2.0.0-rc.2) (2019-01-27) + + +### Bug Fixes + +* make padding for md code blocks and code samples consistent ([007752d](https://github.com/Rebilly/ReDoc/commit/007752d)) +* make syntax highlighting for md js code blocks same as for payload samples ([d197c0f](https://github.com/Rebilly/ReDoc/commit/d197c0f)) +* Only display API version if present ([#773](https://github.com/Rebilly/ReDoc/issues/773)) ([fb3cb36](https://github.com/Rebilly/ReDoc/commit/fb3cb36)) + + + # [2.0.0-rc.1](https://github.com/Rebilly/ReDoc/compare/v2.0.0-rc.0...v2.0.0-rc.1) (2019-01-17) diff --git a/cli/README.md b/cli/README.md index 7b836f47..9c4d8dd6 100644 --- a/cli/README.md +++ b/cli/README.md @@ -17,5 +17,6 @@ Some examples: - Bundle with main color changed to `orange`:
`$ redoc-cli bundle [spec] --options.theme.colors.primary.main=orange` - Serve with `nativeScrollbars` option set to true:
`$ redoc-cli serve [spec] --options.nativeScrollbars` - Bundle using custom template (check [default template](https://github.com/Rebilly/ReDoc/blob/master/cli/template.hbs) for reference):
`$ redoc-cli bundle [spec] -t custom.hbs` +- Bundle using custom template and add custom `templateOptions`:
`$ redoc-cli bundle [spec] -t custom.hbs --templateOptions.metaDescription "Page meta description"` For more details run `redoc-cli --help`. diff --git a/cli/index.ts b/cli/index.ts index 39e3d76a..342722b2 100644 --- a/cli/index.ts +++ b/cli/index.ts @@ -26,6 +26,7 @@ interface Options { output?: string; title?: string; templateFileName?: string; + templateOptions?: any; redocOptions?: any; } @@ -67,6 +68,7 @@ YargsParser.command( ssr: Boolean(argv.ssr), watch: Boolean(argv.watch), templateFileName: String(argv.template), + templateOptions: argv.templateOptions || {}, redocOptions: argv.options || {}, }; @@ -114,6 +116,7 @@ YargsParser.command( cdn: Boolean(argv.cdn), title: String(argv.title), templateFileName: String(argv.template), + templateOptions: argv.templateOptions || {}, redocOptions: argv.options || {}, }; @@ -130,6 +133,9 @@ YargsParser.command( describe: 'Path to handlebars page template, see https://git.io/vh8fP for the example ', type: 'string', }) + .options('templateOptions', { + describe: 'Additional options that you want pass to template. Use dot notation, e.g. templateOptions.metaDescription', + }) .options('options', { describe: 'ReDoc options, use dot notation, e.g. options.nativeScrollbars', }).argv; @@ -209,7 +215,7 @@ async function bundle(pathToSpec, options: Options = {}) { async function getPageHTML( spec: any, pathToSpec: string, - { ssr, cdn, title, templateFileName, redocOptions = {} }: Options, + { ssr, cdn, title, templateFileName, templateOptions, redocOptions = {} }: Options, ) { let html; let css; @@ -243,15 +249,16 @@ async function getPageHTML( ssr ? 'hydrate(__redoc_state, container);' : `init("spec.json", ${JSON.stringify(redocOptions)}, container)` - }; + }; `, redocHead: ssr ? (cdn - ? '' - : ``) + css + ? '' + : ``) + css : '', title, + templateOptions, }); } diff --git a/package.json b/package.json index bef23f02..92485e2e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "redoc", - "version": "2.0.0-rc.1", + "version": "2.0.0-rc.2", "description": "ReDoc", "repository": { "type": "git", @@ -125,10 +125,10 @@ "yaml-js": "^0.2.3" }, "peerDependencies": { - "mobx": "^4.2.0", + "mobx": "^4.2.0 || ^5.0.0", "react": "^16.2.0", "react-dom": "^16.2.0", - "styled-components": "^4.0.1" + "styled-components": "^4.1.1" }, "dependencies": { "classnames": "^2.2.6",