Examples of code and session blocks
This file (project.md) has some example code and session blocks including a doctest directive example.
An example with a blank line in the output
def greeting(name: str) -> str: return 'Hello' + '\n\n' + name print(greeting('World!'))
Here is the output it produces.
Interactive Python session requires
<BLANKINE> in the expected output
Blank lines in the expected output must be replaced with
To see the
<BLANKLINE> navigate to project.md unrendered.
>>> print('Hello\n\nWorld!') Hello World!
Interactive Python session with doctest directive
Here is an interactive Python session showing an
expected exception and use of the doctest directive
To see the doctest directive navigate to project.md unrendered.
>>> int('def') Traceback (most recent call last): ... ValueError:
py as the fenced code block info_string
>>> coffee = 5 >>> coding = 5 >>> enjoyment = 10 >>> print(coffee + coding) 10 >>> coffee + coding == enjoyment True