Skip to content

Commit

Permalink
merged from develop, swagger-api#824
Browse files Browse the repository at this point in the history
  • Loading branch information
fehguy committed Jan 29, 2015
1 parent 8d4a0e7 commit fcb12c1
Show file tree
Hide file tree
Showing 10 changed files with 1,287 additions and 10 deletions.
1,272 changes: 1,272 additions & 0 deletions lib/marked.js

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions src/main/coffeescript/SwaggerUi.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ class SwaggerUi extends Backbone.Router
switch @options.docExpansion
when "full" then @expandAll()
when "list" then @listAll()
@renderGFM()
@options.onComplete(@api, @) if @options.onComplete
setTimeout(
=>
Expand Down Expand Up @@ -125,4 +126,9 @@ class SwaggerUi extends Backbone.Router
@options.onFailure(data) if @options.onFailure?
val

# Renders GFM for elements with 'markdown' class
renderGFM: (data = '') ->
$('.markdown').each (index) ->
$(this).html(marked($(this).html()))

window.SwaggerUi = SwaggerUi
5 changes: 2 additions & 3 deletions src/main/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
<html>
<head>
<title>Swagger UI</title>
<link href='css/typography.css' media='screen' rel='stylesheet' type='text/css'/>
<link href='//fonts.googleapis.com/css?family=Droid+Sans:400,700' rel='stylesheet' type='text/css'/>
<link href='css/reset.css' media='screen' rel='stylesheet' type='text/css'/>
<link href='css/screen.css' media='screen' rel='stylesheet' type='text/css'/>
<link href='css/typography.css' media='print' rel='stylesheet' type='text/css'/>
<link href='css/reset.css' media='print' rel='stylesheet' type='text/css'/>
<link href='css/screen.css' media='print' rel='stylesheet' type='text/css'/>
<script type="text/javascript" src="lib/shred.bundle.js"></script>
Expand All @@ -16,10 +15,10 @@
<script src='lib/handlebars-1.0.0.js' type='text/javascript'></script>
<script src='lib/underscore-min.js' type='text/javascript'></script>
<script src='lib/backbone-min.js' type='text/javascript'></script>
<script src='lib/swagger.js' type='text/javascript'></script>
<script src='lib/swagger-client.js' type='text/javascript'></script>
<script src='swagger-ui.js' type='text/javascript'></script>
<script src='lib/highlight.7.3.pack.js' type='text/javascript'></script>
<script src='lib/marked.js' type='text/javascript'></script>

<!-- enabling this will enable oauth2 implicit scope support -->
<script src='lib/swagger-oauth.js' type='text/javascript'></script>
Expand Down
2 changes: 1 addition & 1 deletion src/main/template/main.handlebars
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div class='info' id='api_info'>
{{#if info}}
<div class="info_title">{{info.title}}</div>
<div class="info_description">{{{info.description}}}</div>
<div class="info_description markdown">{{{info.description}}}</div>
{{#if info.termsOfServiceUrl}}<div class="info_tos"><a href="{{info.termsOfServiceUrl}}">Terms of service</a></div>{{/if}}
{{#if info.contact}}<div class='info_contact'><a href="mailto:{{info.contact.name}}">Contact the developer</a></div>{{/if}}
{{#if info.license}}<div class='info_license'><a href='{{info.license.url}}'>{{info.license.name}}</a></div>{{/if}}
Expand Down
2 changes: 1 addition & 1 deletion src/main/template/operation.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
{{/if}}
{{#if description}}
<h4>Implementation Notes</h4>
<p>{{{description}}}</p>
<p class="markdown">{{{description}}}</p>
{{/if}}
{{#oauth}}
<div class="auth">
Expand Down
2 changes: 1 addition & 1 deletion src/main/template/param.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
{{/if}}

</td>
<td>{{{description}}}</td>
<td class="markdown">{{{description}}}</td>
<td>{{{paramType}}}</td>
<td>
<span class="model-signature"></span>
Expand Down
2 changes: 1 addition & 1 deletion src/main/template/param_list.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@
{{/each}}
</select>
</td>
<td>{{{description}}}</td>
<td class="markdown">{{{description}}}</td>
<td>{{{paramType}}}</td>
<td><span class="model-signature"></span></td>
2 changes: 1 addition & 1 deletion src/main/template/param_readonly.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
{{/if}}
{{/if}}
</td>
<td>{{{description}}}</td>
<td class="markdown">{{{description}}}</td>
<td>{{{paramType}}}</td>
<td><span class="model-signature"></span></td>
2 changes: 1 addition & 1 deletion src/main/template/param_readonly_required.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
{{/if}}
{{/if}}
</td>
<td>{{{description}}}</td>
<td class="markdown">{{{description}}}</td>
<td>{{{paramType}}}</td>
<td><span class="model-signature"></span></td>
2 changes: 1 addition & 1 deletion src/main/template/param_required.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
{{/if}}
</td>
<td>
<strong>{{{description}}}</strong>
<strong><span class="markdown">{{{description}}}</span></strong>
</td>
<td>{{{paramType}}}</td>
<td><span class="model-signature"></span></td>

0 comments on commit fcb12c1

Please sign in to comment.