Advertisement
otubo

Untitled

Apr 23rd, 2021
927
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.40 KB | None | 0 0
  1. #!/usr/bin/env python
  2. import markdown
  3. import html2text
  4. import sys
  5.  
  6. markdownfile = sys.argv[1]
  7. with open(markdownfile, 'r') as f:
  8.     md = f.read()
  9.     html = markdown.markdown(md)
  10.  
  11.  
  12. h = html2text.HTML2Text()
  13.  
  14. h.ignore_links = True
  15. h.wrap_list_items = True
  16. h.unicode_snob = True
  17. h.ignore_emphasis = True
  18. h.bypass_tables = True
  19. h.ignore_tables = True
  20.  
  21. text = h.handle(html)
  22. print (text)
  23.  
  24.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement