in scripts/nb_to_md.py [0:0]
def format_as_terminal(self, commands: str) -> str:
"""Formats a command block to indicate that it contains terminal commands.
Args:
commands: The command block to format.
Returns:
The reformatted command block.
"""
lines = commands.split('\n')
buffer = []
for line in lines:
if line.startswith('!'):
line = '$ {}'.format(line[1:])
buffer.append(line)
return '\n'.join(buffer)