solution_122a.py

#!/usr/bin/python3
# ===============================================================
# main - convert MD file to HTML file
# ===============================================================

import markdown_md_to_html as mdh

# ---- config runtime

mdh.config_runtime(verbose=False)

# ---- test using an input file

##infile  = 'md01.md'
##outfile = 'md01.html'
infile    = 'md02.md'
outfile   = 'md02.html'
##infile  = 'md03.md'
##outfile = 'md03.html'

print()
print(f'process MD file {infile}')

lst = mdh.process_md_file(infile)
##mdh.print_list(lst)
tf = mdh.generate_html_code(lst,outfile)
print()
if tf: print(f'conversion success')
else : print(f'conversion failed')
print()
    
## ---- test using a single line (string)
##mdh.config_runtime(verbose=True)
##line = r'xx__abc**def**ghi\\ j__kl//mno__pqr\\zz'    
##lst = []                    # parser token list
##process_line(line,lst)
##print_list(lst)
##tf = generate_html_code(lst,outfile)
##if tf: print('success')
##else: print('failed')

## ---- test using user input string
##import user_interface as ui
##mdh.config_runtime(verbose=True)
##while True:
##    x = ui.get_user_input('Enter test string: ')
##    if not x:
##        break
##    lst = []
##    process_line(x,lst)
##    print_list(lst)
##    tf = generate_html_code(lst,outfile)
##    if tf: print('success')
##    else: print('failed')
##    u.pause()