@@ -23,43 +23,102 @@ It defaults to ``http``.
2323 # conf.py
2424 httpexample_scheme = " https"
2525
26+
2627 Syntax
2728======
29+ There are two syntaxes, one each for inline and external sources.
30+
31+ The following example is of inline sources.
32+
33+ .. code-block :: rst
34+
35+ .. http:example:: space separated list of tools
36+ A required inline source of a raw plain text HTTP request example.
37+ This is required.
38+
39+
40+ An optional inline source of a raw plain text HTTP response example.
41+ If present, it must be separated from the request by two blank lines.
42+ It must begin with either ``HTTP/VERSION_NUMBER`` or ``HTTP ``.
43+
44+ The following example is of external sources.
45+
46+ .. code-block :: rst
47+
48+ .. http:example:: space separated list of tools
49+ :request: ../relative/path/to/plaintext/request/file
50+ :response: ../relative/path/to/plaintext/response/file
51+
52+ To display the response outside of the tabbed interface, then don't include it in the ``http:example `` directive, but instead list it separately.
53+
54+ For inline sources, use ``code-block `` with the ``http `` lexer.
55+
56+ .. code-block :: rst
57+
58+ .. http:example:: space separated list of tools
59+ A required inline source of a raw plain text HTTP request example.
60+ This is required.
61+
62+ .. code-block:: http
63+ An optional inline source of a raw plain text HTTP response example.
64+
65+ For external sources, use ``literalinclude `` with the ``http `` lexer.
66+
2867.. code-block :: rst
2968
30- .. http:example:: space separated list of tools
31- :request: ../optional/rel/path/to/plaintext/request
32- :response: ../optional/rel/path/to/plaintext/response
69+ .. http:example:: space separated list of tools
70+ :request: ../relative/path/to/plaintext/request/file
71+
72+ .. literalinclude:: ../relative/path/to/plaintext/response/file
73+ :language: http
3374
34- Raw plaintext HTTP request example, which is
35- required only when ``:request:`` is not specified.
3675
3776 Example
3877=======
78+
3979.. code-block :: rst
4080
41- .. http:example:: curl wget httpie requests
81+ .. http:example:: curl wget httpie requests plone-client
4282
43- GET /Plone/front-page HTTP/1.1
83+ POST /Plone/folder HTTP/1.1
4484 Host: localhost:8080
4585 Accept: application/json
86+ Content-Type: application/json
4687 Authorization: Basic YWRtaW46YWRtaW4=
4788
89+
90+ HTTP 200 OK
91+ Content-Type: application/json
92+
93+ {
94+ "@type": "Document",
95+ "title": "My Document"
96+ }
97+
98+
4899 Rendering
49100=========
50- .. http :example :: curl wget httpie requests
51101
52- GET /plone/folder/my-document?expand=breadcrumbs,navigation HTTP/1.1
102+ .. http :example :: curl wget httpie requests plone-client
103+
104+ POST /Plone/folder HTTP/1.1
53105 Host: localhost:8080
54106 Accept: application/json
55- Authorization: Basic YWRtaW46c2VjcmV0
107+ Content-Type: application/json
108+ Authorization: Basic YWRtaW46YWRtaW4=
56109
57110
58- .. code :: javascript
111+ HTTP 200 OK
112+ Content-Type: application/json
59113
60- import PloneClient from ' @plone/client' ;
61- const cli = PloneClient .initialize ({apiPath: ' http://nohost/plone' });
62- const { data , status } = cli .getContent ({path: ' /plone/folder/my-document' , expanders: [' breadcrumbs' , ' navigation' ]})
114+ {
115+ "@type": "Document",
116+ "title": "My Document"
117+ }
118+
119+
120+ .. seealso ::
121+ The :doc: `usage ` provide an extensive demonstration of the capabilities of sphinxcontrib.httpexample.
63122
64123
65124Compatibility with other tab libraries
@@ -138,6 +197,17 @@ sphinxcontrib-httpexample is compatible with the following tab libraries.
138197 :response: ../tests/fixtures/001.response.txt
139198
140199
200+ Custom builders
201+ ===============
202+
203+ sphinxcontrib.httpexample supports custom builders.
204+
205+ See the `issue tracker <https://github.com/collective/sphinxcontrib-httpexample/issues >`_ to request or provide a custom builder.
206+
207+ .. seealso ::
208+ See an example :doc: `custom ` for the `@plone/client <https://www.npmjs.com/package/@plone/client >`_ package, an agnostic library that provides easy access to the Plone REST API from a client written in TypeScript.
209+
210+
141211Supported tools
142212===============
143213
0 commit comments