new_contents: import codecs
  import re
  
  mdFileUrl = 'test.md'
  outData = []
  htmlStart = '''<!DOCTYPE HTML>
  <html lang='en'>
  <head>
    <meta http-equiv='Content-Type' content='text/html; charset=UTF-8' />
    <link rel='stylesheet' href='markflip.css' type='text/css' />
    <title>Generated by MarkFlip</title>
  </head>
  <body>
  '''
  htmlEnd = '''</body>
  </html>
  '''
  
  strongRegex = re.compile(r'\*{2}.+\*{2}')
  emphasisRegex = re.compile(r'[^\*\\]\*[^/]+[^\\]\*[^\*]')
  strikeRegex = re.compile(r'~{2}.+~{2}')
  
  with codecs.open(mdFileUrl,'r','utf-8') as f:
      lines = f.readlines()
      for line in lines:
          line = ' '.join(line.split())
          if not line:
              continue
          for match in strongRegex.findall(line):
              line = line.replace(match, '<strong>{}</strong>'.format(match[2:-2]))
          for match in emphasisRegex.findall(line):
              line = line.replace(match[1:-1], '<em>{}</em>'.format(match[2:-2]))
          for match in strikeRegex.findall(line):
              line = line.replace(match, '<del>{}</del>'.format(match[2:-2]))
          line = line.replace('\*','*')
          if line[0] == '#':
              headerNum = line.split()[0].count('#')
              if headerNum > 6:
                  headerNum = 6
              outData.append('<h{}>{}</h{}>'.format(headerNum, line[headerNum:], headerNum))
          else:
              outData.append('<p>' + line + '</p>')
  
  with codecs.open('MarkFlip.html','w','utf-8') as f:
      f.write(htmlStart)
      for data in outData:
          f.write('  '+data+'\n')
      f.write(htmlEnd)
  
subject: Create MarkFlip.py