|
16 | 16 | * [Routes Configuration](#routes)
|
17 | 17 | * [Using Grape Entities](#grape-entity)
|
18 | 18 | * [Securing the Swagger UI](#oauth)
|
19 |
| -* [Markdown](#md_usage) |
| 19 | +* [Markdown (deprecated)](#md_usage) |
20 | 20 | * [Example](#example)
|
21 | 21 | * [Rake Tasks](#rake)
|
22 | 22 |
|
|
196 | 196 | * [add_base_path](#add_base_path)
|
197 | 197 | * [add_version](#add_version)
|
198 | 198 | * [doc_version](#doc_version)
|
199 |
| -* [markdown](#markdown) |
200 | 199 | * [endpoint_auth_wrapper](#endpoint_auth_wrapper)
|
201 | 200 | * [swagger_endpoint_guard](#swagger_endpoint_guard)
|
202 | 201 | * [token_owner](#token_owner)
|
@@ -268,18 +267,8 @@ add_swagger_documentation \
|
268 | 267 | ```
|
269 | 268 |
|
270 | 269 | <a name="markdown" />
|
271 |
| -#### markdown: |
272 |
| -Allow markdown in `detail`, default is `false`. (disabled) See [below](#md_usage) for details. |
273 |
| -
|
274 |
| -```ruby |
275 |
| -add_swagger_documentation \ |
276 |
| - markdown: GrapeSwagger::Markdown::KramdownAdapter.new |
277 |
| -``` |
278 |
| -or alternative |
279 |
| -```ruby |
280 |
| -add_swagger_documentation \ |
281 |
| - markdown: GrapeSwagger::Markdown::RedcarpetAdapter.new |
282 |
| -``` |
| 270 | +#### markdown: (deprecated) |
| 271 | +OAPI accepts GFM for descriptions |
283 | 272 |
|
284 | 273 | <a name="endpoint_auth_wrapper" />
|
285 | 274 | #### endpoint_auth_wrapper:
|
@@ -1087,77 +1076,11 @@ The lambda is checking whether the user is authenticated (if not, the token_owne
|
1087 | 1076 | role - only admins can see this endpoint.
|
1088 | 1077 |
|
1089 | 1078 | <a name="md_usage" />
|
1090 |
| -## Markdown in Detail |
1091 |
| -
|
1092 |
| -The grape-swagger gem allows you to add an explanation in markdown in the detail field. Which would result in proper formatted markdown in Swagger UI. |
1093 |
| -Grape-swagger uses adapters for several markdown formatters. It includes adapters for [kramdown](http://kramdown.rubyforge.org) (kramdown [syntax](http://kramdown.rubyforge.org/syntax.html)) and [redcarpet](https://github.com/vmg/redcarpet). |
1094 |
| -The adapters are packed in the GrapeSwagger::Markdown modules. We do not include the markdown gems in our gemfile, so be sure to include or install the depended gems. |
1095 |
| -
|
1096 |
| -To use it, add a new instance of the adapter to the markdown options of `add_swagger_documentation`, such as: |
1097 |
| -```ruby |
1098 |
| -add_swagger_documentation \ |
1099 |
| - markdown: GrapeSwagger::Markdown::KramdownAdapter.new(options) |
1100 |
| -``` |
1101 |
| -and write your route details in GFM, examples could be find in [details spec](blob/master/spec/swagger_v2/api_swagger_v2_detail_spec.rb) |
1102 |
| -
|
1103 |
| -
|
1104 |
| -#### Kramdown |
1105 |
| -If you want to use kramdown as markdown formatter, you need to add kramdown to your gemfile. |
1106 |
| -
|
1107 |
| -```ruby |
1108 |
| -gem 'kramdown' |
1109 |
| -``` |
1110 |
| -
|
1111 |
| -Configure your api documentation route with: |
1112 |
| -```ruby |
1113 |
| -add_swagger_documentation \ |
1114 |
| - markdown: GrapeSwagger::Markdown::KramdownAdapter.new(options) |
1115 |
| -``` |
1116 |
| -
|
| 1079 | +## Markdown in Detail (deprecated) |
1117 | 1080 |
|
1118 |
| -#### Redcarpet |
1119 |
| -As alternative you can use [redcarpet](https://github.com/vmg/redcarpet) as formatter, you need to include redcarpet in your gemspec. If you also want to use [rouge](https://github.com/jneen/rouge) as syntax highlighter you also need to include it. |
1120 |
| -
|
1121 |
| -```ruby |
1122 |
| -gem 'redcarpet' |
1123 |
| -gem 'rouge' |
1124 |
| -``` |
1125 |
| -
|
1126 |
| -Configure your api documentation route with: |
1127 |
| -
|
1128 |
| -```ruby |
1129 |
| -add_swagger_documentation( |
1130 |
| - markdown: GrapeSwagger::Markdown::RedcarpetAdapter.new(render_options: { highlighter: :rouge }) |
1131 |
| -) |
1132 |
| -``` |
1133 |
| -
|
1134 |
| -Alternatively you can disable rouge by adding `:none` as highlighter option. You can add redcarpet extensions and render options trough the `extenstions:` and `render_options:` parameters. |
1135 |
| -
|
1136 |
| -
|
1137 |
| -#### Custom markdown formatter |
1138 |
| -
|
1139 |
| -You can also add your custom adapter for your favourite markdown formatter, as long it responds to the method `markdown(text)` and it formats the given text. |
1140 |
| -
|
1141 |
| -
|
1142 |
| -```ruby |
1143 |
| -module API |
1144 |
| -
|
1145 |
| - class FancyAdapter |
1146 |
| - attr_reader :adapter |
1147 |
| -
|
1148 |
| - def initialize(options) |
1149 |
| - require 'superbmarkdownformatter' |
1150 |
| - @adapter = SuperbMarkdownFormatter.new options |
1151 |
| - end |
1152 |
| -
|
1153 |
| - def markdown(text) |
1154 |
| - @adapter.render_supreme(text) |
1155 |
| - end |
1156 |
| - end |
1157 |
| -
|
1158 |
| - add_swagger_documentation markdown: FancyAdapter.new(no_links: true) |
1159 |
| -end |
1160 |
| -``` |
| 1081 | +Usage of option `markdown` won't no longer be supported, |
| 1082 | +cause OAPI accepts [GFM](https://help.github.com/articles/github-flavored-markdown) and plain text. |
| 1083 | +(see: [description of `Info`](https://github.com/OAI/OpenAPI-Specification/blob/OpenAPI.next/versions/2.0.md#info-object)) |
1161 | 1084 |
|
1162 | 1085 |
|
1163 | 1086 | <a="example" />
|
|
0 commit comments