-
Notifications
You must be signed in to change notification settings - Fork 1
/
README
114 lines (74 loc) · 2.88 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
*************************************************************************
``sphinxcontrib-jsdemo`` -- HTML/Javascript Demo extension for Sphinx
*************************************************************************
Overview
========
``sphinxcontrib-jsdemo`` is an extension for embedding HTML/Javascript
demo snippets into Sphinx_ documents.
You can see this extension in action at
http://htsql.org/htraf/index.html. For more examples, see ``demo``
directory in the source distribution.
This software is written by Kirill Simonov (`Prometheus Research, LLC`_)
and released under BSD license.
Usage
=====
To enable this extension, add the following line to ``conf.py``::
extensions.append('sphinxcontrib.jsdemo')
Now you can include a snippet of HTML/Javascript code to a Sphinx
document using ``demo`` directive. For example::
.. demo::
<button>Click me!</button>
The directive renders its content twice: as a raw HTML block (demo) and
as a literal block (source). Clicking on the *Demo* and *Source* headers
toggles visibility of the blocks.
Option ``layout`` allows you to control the relative order of the blocks.
For example, the following directive renders the source block before the
demo block with the content of the demo block initially hidden::
.. demo::
:layout: +source, -demo
<button>Click me, too!</button>
Reference
=========
Directives
----------
``demo``
Inserts a demo widget.
The directive is rendered as a composite node with two blocks:
* A *demo* block containing raw HTML content.
* A *source* block with the same content in literal form.
Clicking on a block header toggles the block's visibility.
Options:
``layout``
This option controls the order of the blocks and their initial
visibility. It must contain comma-separated list of blocks with
optional ``+`` or ``-`` indicators specifying the initial
visibility. Examples:
``demo, source``
Render the *demo* block before the *source* block.
This is the default value of the option.
``+source, -demo``
Render the *source* block before the *demo* block.
The content of the *demo* block is hidden.
``-demo``
Render the *demo* block only; hidden.
Configuration parameters
------------------------
``demo_layout``
The layout for ``demo`` directives with no ``layout`` option.
By default, ``+demo, +source``.
CSS classes
-----------
``demo-wrapper``
Wraps the demo directive.
``demo-header``
Wraps a block header.
``demo-hide``
If set on a block header, indicates that the content of the block
is hidden.
``demo-area``
Wraps the demo block.
``demo-source``
Wraps the source block.
.. _Sphinx: http://sphinx-doc.org/
.. _Prometheus Research, LLC: http://prometheusresearch.com/
.. vim: set spell spelllang=en textwidth=72: