| 1 |
{% extends "layout.html" %} |
| 2 |
{% set sidebars = sidebars + ["demo_sidebar.html"] %} |
| 3 |
|
| 4 |
{% block extrahead %} |
| 5 |
{{ super() }} |
| 6 |
<link rel="stylesheet" type="text/css" href="{{ pathto("_static/demo.css", 1) }}"> |
| 7 |
{% endblock %} |
| 8 |
|
| 9 |
{% block htmltitle %}<title>Demo{{ titlesuffix }}</title>{% endblock %} |
| 10 |
|
| 11 |
{% block body %} |
| 12 |
{{ body }} |
| 13 |
|
| 14 |
<h1>Try out Pygments!</h1> |
| 15 |
|
| 16 |
<noscript> |
| 17 |
<h2>This website requires JavaScript (and WebAssembly)</h2> |
| 18 |
|
| 19 |
You can also try out pygments locally by running <code>pip install pygments</code>. |
| 20 |
Then you can use <a href="{{pathto('docs/cmdline')}}">the command-line interface</a>. |
| 21 |
</noscript> |
| 22 |
|
| 23 |
<div id="try"> |
| 24 |
<p> |
| 25 |
<label>Language |
| 26 |
<select id="lang" autofocus> |
| 27 |
<option value="">guess the language</option> |
| 28 |
{% for name, info, _, _ in lexers %} |
| 29 |
<option value="{{info.0}}">{{name}}</option> |
| 30 |
{% endfor %} |
| 31 |
</select> |
| 32 |
</label> |
| 33 |
<span id=guessed-lexer></span> |
| 34 |
</p> |
| 35 |
<p> |
| 36 |
<label> |
| 37 |
Enter some code: |
| 38 |
<textarea id="code" rows="1" cols="60" spellcheck="false"></textarea> |
| 39 |
</label> |
| 40 |
</p> |
| 41 |
<p> |
| 42 |
<label> |
| 43 |
Alternatively you can upload a file: |
| 44 |
<input type="file" id="file"> |
| 45 |
</label> |
| 46 |
<button id="reset-file">Reset</button> |
| 47 |
</p> |
| 48 |
<div id="format-settings"> |
| 49 |
<label> |
| 50 |
Formatter |
| 51 |
<select id=formatter> |
| 52 |
<option value=html>HTML</option> |
| 53 |
<option value=tokens>tokens</option> |
| 54 |
</select> |
| 55 |
</label> |
| 56 |
<label>Style |
| 57 |
<select id="style"> |
| 58 |
<optgroup label="Good contrast"> |
| 59 |
{% for style in styles_aa %} |
| 60 |
<option data-wcag=aa>{{style.name}}</option> |
| 61 |
{% endfor %} |
| 62 |
</optgroup> |
| 63 |
<optgroup label="Suboptimal contrast"> |
| 64 |
{% for style in styles_sub_aa %} |
| 65 |
<option>{{style.name}}</option> |
| 66 |
{% endfor %} |
| 67 |
</optgroup> |
| 68 |
</select> |
| 69 |
</label> |
| 70 |
<span id=contrast-warning hidden>style may have poor contrast</span> |
| 71 |
</div> |
| 72 |
</form> |
| 73 |
</div> |
| 74 |
|
| 75 |
<div id="loading" hidden> |
| 76 |
<img src="{{ pathto("_static/spinner.gif", 1) }}" width="20"> |
| 77 |
<span id="loading-text">loading Python...</span> |
| 78 |
</div> |
| 79 |
|
| 80 |
<style id=css-style></style> |
| 81 |
|
| 82 |
<div id="hlcode"></div> |
| 83 |
|
| 84 |
<div id="code-header" hidden> |
| 85 |
<div class=flex-grow-1></div> |
| 86 |
<button onclick="download_code()">Download</button> |
| 87 |
<a id="copylink" role="button">Copy link</a> |
| 88 |
<span hidden id="uri-too-long">(Copy link unavailable because code too long)</span> |
| 89 |
</div> |
| 90 |
|
| 91 |
<p>The highlighting here is performed in-browser using |
| 92 |
a WebAssembly translation of the latest Pygments master branch, courtesy of |
| 93 |
<a href="https://github.com/iodide-project/pyodide">Pyodide</a>.</p> |
| 94 |
<p>Your content is neither sent over the web nor stored anywhere.</p> |
| 95 |
|
| 96 |
<script type="text/javascript" src="{{ pathto("_static/demo.js", 1) }}"></script> |
| 97 |
{% endblock %} |