Code Examples

Here's a few small code examples to demonstrate how having rst processing on the end of an api is useful

JavaScript Required

JavaScript is required to view the examples please configure your browser to run JavaScript for this site

RST Preview

Here is some RST that we are going to convert by posting to the API.

Note: Bear in mind this code is on the same domain as the API. If you are wanting to carry out Ajax Posts cross-domain you will need to point your javascript at a server-side script on your domain which will subsequently query the API for you.

Heading level 2
--------------------

This is rst! 

Heading level 2
--------------------

And now for some source code:

Some Python (level 3)
~~~~~~~~~~~~~~~~~~~~~~~~~

.. sourcecode:: python
    
    def linecol(doc, pos):
        lineno = doc.count('\n', 0, pos) + 1
        if lineno == 1:
            colno = pos
        else:
            colno = pos - doc.rindex('\n', 0, pos)
        return lineno, colno

Convert to HTML

Bookmarkable links to RST documents

In true Blue Peter fashion here one I've made earlier based on the same example as above: View Example