def md2rst(md_lines):
lvl2header_char = {<NUM_LIT:1>: '<STR_LIT:=>', <NUM_LIT:2>: '<STR_LIT:->', <NUM_LIT:3>: '<STR_LIT>'}<EOL>for md_line in md_lines:<EOL><INDENT>if md_line.startswith('<STR_LIT:#>'):<EOL><INDENT>header_indent, header_text = md_line.split('<STR_LIT:U+0020>', <NUM_LIT:1>)<EOL>yield header_text<EOL>header_char = lvl2header_char[len(header_indent)]<EOL>yield header_char * len(header_text)<EOL><DEDENT>else:<EOL><INDENT>yield md_line<EOL><DEDENT><DEDENT>
Only converts headers