performance #1956 added highlightSizeThreshold option disable highlight when length more than highlightSizeThreshold

This commit is contained in:
Anna Bodnia
2016-02-22 17:24:08 +02:00
parent 8a658a197c
commit ed7c7261be
6 changed files with 58 additions and 22 deletions

View File

@@ -20,6 +20,7 @@
<script src='lib/backbone-min.js' type='text/javascript'></script>
<script src='swagger-ui.js' type='text/javascript'></script>
<script src='lib/highlight.9.1.0.pack.js' type='text/javascript'></script>
<script src='lib/highlight.9.1.0.pack_extended.js' type='text/javascript'></script>
<script src='lib/jsoneditor.min.js' type='text/javascript'></script>
<script src='lib/marked.js' type='text/javascript'></script>
<script src='lib/swagger-oauth.js' type='text/javascript'></script>
@@ -38,6 +39,10 @@
url = "http://petstore.swagger.io/v2/swagger.json";
}
hljs.configure({
highlightSizeThreshold: 5000
});
// Pre load translate...
if(window.SwaggerTranslator) {
window.SwaggerTranslator.translate();

View File

@@ -13,13 +13,13 @@
<div class="snippet">
{{#if sampleJSON}}
<div class="snippet_json">
<pre><code class="{{#ifCond sampleJSON.length ">" 5000}}nohighlight{{/ifCond}}">{{sampleJSON}}</code></pre>
<pre><code>{{sampleJSON}}</code></pre>
{{#if isParam}}<small class="notice" data-sw-translate></small>{{/if}}
</div>
{{/if}}
{{#if sampleXML}}
<div class="snippet_xml">
<pre><code class="{{#ifCond sampleXML.length ">" 5000}}nohighlight{{/ifCond}}">{{sampleXML}}</code></pre>
<pre><code>{{sampleXML}}</code></pre>
{{#if isParam}}<small class="notice" data-sw-translate></small>{{/if}}
</div>
{{/if}}