prompt-toolkit / python-prompt-toolkit

Library for building powerful interactive command line applications in Python
https://python-prompt-toolkit.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
9.37k stars 716 forks source link

Documentation error at ReadTheDocs #774

Open ReddyKilowatt opened 6 years ago

ReddyKilowatt commented 6 years ago

https://python-prompt-toolkit.readthedocs.io/en/stable/pages/printing_text.html#printing-text shows this code

`from prompt_toolkit.styles import Style

style = Style.from_dict({ 'pygments.keyword': 'underline', 'pygments.literal.string': 'bg:#00ff00 #ffffff', }) print_formatted_text(PygmentsTokens(tokens), style=style)`

However, tokens is not defined, resulting in "NameError: name 'tokens' is not defined"

ReddyKilowatt commented 6 years ago

The issue above uses these versions: prompt_toolkit 2.07, with Python 3.6.6 (32-Bit) on Windows 7 Pro, 64-Bit

Martmists-GH commented 6 years ago

This should not be an issue as the text just above mentions being an addition to the code block just above it, as print_formatted_text is also not defined.

ReddyKilowatt commented 6 years ago

I see that tokens is defined in the previous example. I have been treating each of these examples discretely.