[('text', # 0 '\n' 'Alternating text and code\n' '=========================\n' '\n' 'Sphinx-Gallery is capable of transforming Python files into reST files\n' 'with a notebook structure. For this to be used you need to respect some ' 'syntax\n' 'rules. This example demonstrates how to alternate text and code blocks and ' 'some\n' 'edge cases. It was designed to be compared with the\n' ':download:`source Python script `.', 1), ('text', # 1 'This is the first text block and directly follows the header docstring ' 'above.\n', 12, ), ('code', '\nimport numpy as np # noqa: F401\n\n', 13), # 2 ('code', # 3 '\n' "# You can separate code blocks using either a single line of ``#``'s\n" '# (>=20 columns), ``#%%``, or ``# %%``. For consistency, it is recommend ' 'that\n' "# you use only one of the above three 'block splitter' options in your " 'project.\n' 'A = 1\n' '\n' 'import matplotlib.pyplot as plt # noqa: F401\n' '\n', 17), ('text', 'Block splitters allow you alternate between code and text blocks **and**\n' 'separate sequential blocks of code (above) and text (below).\n', 26, ), ('text', "A line of ``#``'s also works for separating blocks. The above line of " "``#``'s\n" 'separates the text block above from this text block. Notice however, that\n' 'separated text blocks only shows as a new lines between text, in the ' 'rendered\n' 'output.\n', 30), ('code', # 4 '\n' '\n' 'def dummy():\n' ' """This should not be part of a \'text\' block\'""" # noqa: D404\n' '\n' ' # %%\n' ' # This comment inside a code block will remain in the code block\n' ' pass\n' '\n' '\n' "# this line should not be part of a 'text' block\n" '\n', 34), ('text', '####################################################################\n' '\n' 'The above syntax makes a line cut in Sphinx. Note the space between the ' 'first\n' "``#`` and the line of ``#``'s.\n", 47, ), ('text', '.. warning::\n' ' The next kind of comments are not supported (notice the line of ' "``#``'s\n" ' and the ``# %%`` start at the margin instead of being indented like\n' " above) and become too hard to escape so just don't use code like " 'this::\n' '\n' ' def dummy2():\n' ' """Function docstring"""\n' ' ####################################\n' ' # This comment\n' ' # %%\n' ' # and this comment inside python indentation\n' ' # breaks the block structure and is not\n' ' # supported\n' ' dummy2\n' '\n', 54), ('code', '\n' '"""Free strings are not supported. They will be rendered as a code ' 'block"""\n' '\n', 69, ), ('text', 'New lines can be included in your text block and the parser\n' 'is capable of retaining this important whitespace to work with Sphinx.\n' 'Everything after a block splitter and starting with ``#`` then one space,\n' 'is interpreted by Sphinx-Gallery to be a reST text block. Keep your text\n' 'block together using ``#`` and a space at the beginning of each line.\n' '\n' 'reST header within text block\n' '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n', 73, ), ('code', '\nprint("one")\n\n', 81), ('code', '\n# another way to separate code blocks shown above\nB = 1\n\n', 86, ), ('text', 'Code blocks containing Jupyter magic are executable\n' ' .. code-block:: bash\n' '\n' ' %%bash\n' ' # This could be run!\n\n', 91, ), ('text', 'Last text block.\n' '\n' "That's all folks !\n" '\n' '.. literalinclude:: plot_parse.py\n' '\n' '\n', 99, )]