Did you try "literalinclude"?

http://www.sphinx-doc.org/en/stable/markup/code.html#directive-literalinclude

This might work:

.. literalinclude:: data.txt
   :language: json

cheers,
Matthias

On Mon, Jan 11, 2016 at 11:33 AM, Peng Dai <[email protected]> wrote:
> hi, I use the sphinx to write the api doc for our android and IOS developer.
>
> now I usually write something like this:
>
> api 1
> -----
>
> url:
>     http://baidu.com
>
> param:
>
>
> method:
>     GET
>
> data:
>
>    1) 失败
>    2)ok::
>
>        {'data': 'ok'}
>
> now I want to generate the data automatic while run the testcase. and
> use .. include:: directive to include this data file.
>
> It works ok if I write it like this.
>
> data:
>
>        1) ok, 如下
>        .. include:: data.txt
>
> but I donot like the format, I would like something like below.
>
> data:
>
>       1) ok 如下::
>
>              .. include: data.txt
>
> this will not work. so is there any way to do this or any other other to
> highlight the json-format data?
> thanks for help in advance.
>
> --
> You received this message because you are subscribed to the Google Groups
> "sphinx-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/sphinx-users.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"sphinx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sphinx-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to