Skip to content

Commit 5a3a48f

Browse files
author
Marco Paolini
committed
Fix python code example display
1 parent 2f9b7fb commit 5a3a48f

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

README.rst

+15-11
Original file line numberDiff line numberDiff line change
@@ -33,24 +33,28 @@ Usage
3333

3434
Make sure ``libgraphqlparser`` is available to the loader. You can add its base dir to ``LD_LIBRARY_PATH``.
3535

36-
Then you can start parsing by creating your custom visitor class::
36+
Then you can start parsing by creating your custom visitor class:
3737

38-
from graphql_parser import GraphQLAstVisitor
38+
.. code-block:: python
3939
40-
class MyVisitor(GraphQLAstVisitor.GraphQLAstVisitor):
40+
from graphql_parser import GraphQLAstVisitor
4141
42-
def visit_field(self, node):
43-
print('start field %s visit' % node)
42+
class MyVisitor(GraphQLAstVisitor.GraphQLAstVisitor):
4443
45-
def end_visit_field(self, node):
46-
print('end field %s visit' % node)
44+
def visit_field(self, node):
45+
print('start field %s visit' % node)
4746
48-
And using it to visit a parsed query::
47+
def end_visit_field(self, node):
48+
print('end field %s visit' % node)
4949
50-
from graphql_parser import GraphQLParser
50+
And using it to visit a parsed query:
5151

52-
node = GraphQLParser.graphql_parse_string(query)
53-
MyVisitor().visit_node(node)
52+
.. code-block:: python
53+
54+
from graphql_parser import GraphQLParser
55+
56+
node = GraphQLParser.graphql_parse_string(query)
57+
MyVisitor().visit_node(node)
5458
5559
5660
Building from source checkout

0 commit comments

Comments
 (0)