##// END OF EJS Templates
Add linebreak to docstring to fix markup and silence Sphinx waraning....
Add linebreak to docstring to fix markup and silence Sphinx waraning. Without the added linebreak the line of ----- is treated as heading markup for the line below, and it is broken markup because it is an overline without an underline. With the added linebreak the line of ------ is rendered as an hr element and the line below is also rendered.

File last commit:

r22430:95ed0855
r24065:6667a88e
Show More
cwd_prompt.py
26 lines | 616 B | text/x-python | PythonLexer
"""This is an example that shows how to create new prompts for IPython
"""
from IPython.terminal.prompts import Prompts, Token
import os
class MyPrompt(Prompts):
def in_prompt_tokens(self, cli=None):
return [(Token, os.getcwd()),
(Token.Prompt, '>>>')]
def load_ipython_extension(shell):
new_prompts = MyPrompt(shell)
new_prompts.old_prompts = shell.prompts
shell.prompts = new_prompts
def unload_ipython_extension(shell):
if not hasattr(shell.prompts, 'old_prompts'):
print("cannot unload")
else:
shell.prompts = shell.prompts.old_prompts