##// END OF EJS Templates
Cleaning up markdown output.
Brian Granger -
Show More
@@ -475,9 +475,12 b" def highlight(src, lang='python'):"
475 475 class ConverterMarkdown(Converter):
476 476 extension = 'md'
477 477
478 def __init__(self, infile, highlight_source=False):
478 def __init__(self, infile, highlight_source=True, show_prompts=False,
479 inline_prompt=False):
479 480 super(ConverterMarkdown, self).__init__(infile)
480 481 self.highlight_source = highlight_source
482 self.show_prompts = show_prompts
483 self.inline_prompt = inline_prompt
481 484
482 485 @DocInherit
483 486 def render_heading(self, cell):
@@ -488,13 +491,18 b' class ConverterMarkdown(Converter):'
488 491 if not cell.input:
489 492 return []
490 493 lines = []
491 #lines.append('----')
494 if self.show_prompts and not self.inline_prompt:
492 495 lines.extend(['*In[%s]:*' % cell.prompt_number, ''])
493 src = highlight(cell.input) if self.highlight_source else \
494 indent(cell.input)
496 if self.show_prompts and self.inline_prompt:
497 prompt = 'In[%s]: ' % cell.prompt_number
498 input_lines = cell.input.split('\n')
499 src = prompt + input_lines[0] + '\n' + indent('\n'.join(input_lines[1:]), nspaces=len(prompt))
500 else:
501 src = cell.input
502 src = highlight(src) if self.highlight_source else indent(src)
495 503 lines.extend([src, ''])
496 if cell.outputs:
497 lines.extend(['==>', ''])
504 if cell.outputs and self.show_prompts and not self.inline_prompt:
505 lines.extend(['*Out[%s]:*' % cell.prompt_number, ''])
498 506 for output in cell.outputs:
499 507 conv_fn = self.dispatch(output.output_type)
500 508 lines.extend(conv_fn(output))
@@ -538,7 +546,7 b' class ConverterMarkdown(Converter):'
538 546
539 547 @DocInherit
540 548 def _img_lines(self, img_file):
541 return ['', '![image](%s)' % img_file, '']
549 return ['', '![](%s)' % img_file, '']
542 550
543 551 @DocInherit
544 552 def render_display_format_text(self, output):
General Comments 0
You need to be logged in to leave comments. Login now